-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #384 from primer/year_test
Adding a test to check for the current year in the license and source…
- Loading branch information
Showing
11 changed files
with
43 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/bin/bash | ||
set -e | ||
$(dirname $0)/npm-run ava --verbose $(dirname $0)/../tests/modules/test-*.js | ||
$(dirname $0)/npm-run ava --verbose $(dirname $0)/../tests/modules/test-document-styles.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const test = require("ava") | ||
const fs = require("fs-extra") | ||
const globby = require("globby") | ||
|
||
const year = (new Date()).getFullYear() | ||
const yearRegex = new RegExp(`Copyright \\(c\\) ${year} GitHub Inc\\.`) | ||
|
||
test(`LICENSE files have the current year ${year}`, t => { | ||
return globby(["**/LICENSE", "!**/node_modules/**/LICENSE"]) | ||
.then(paths => { | ||
t.plan(paths.length) | ||
return paths.map(path => { | ||
const license = fs.readFileSync(path, "utf8") | ||
return t.regex(license, yearRegex, `The license "${path}" does not include the current year ${year}`) | ||
}) | ||
}) | ||
}) | ||
|
||
test(`Source header copyrights have the current year ${year}`, t => { | ||
return globby(["**/*.css", "**/*.scss", "!**/node_modules/**", "!**/build/**"]) | ||
.then(paths => { | ||
t.plan(paths.length) | ||
return paths.map(path => { | ||
const source = fs.readFileSync(path, "utf8") | ||
if (source.match(/Copyright \(c\)/)) { | ||
return t.regex(source, yearRegex, `The source's header "${path}" does not include the current year ${year}`) | ||
} else { | ||
return t.true(true) | ||
} | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters