-
Notifications
You must be signed in to change notification settings - Fork 781
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests: Add structure test to keep suites in sync
Bump cli/eslintrc from es2017 to es2018 to allow use of the RegExp `s` flag (dotAll). This is supported since Node 8+. Ref #1511.
- Loading branch information
Showing
11 changed files
with
93 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"parserOptions": { | ||
"ecmaVersion": 2017 | ||
"ecmaVersion": 2018 | ||
}, | ||
"env": { | ||
"node": 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
const fs = require( "fs" ); | ||
const glob = require( "tiny-glob/sync" ); | ||
|
||
// This is a meta test to validate structural expectations of our | ||
// tests, such as checking for fixture files that aren't used or | ||
// missing from one of the test targets. | ||
QUnit.module( "structure", () => { | ||
|
||
QUnit.module( "test/main/*.js", () => { | ||
const files = fs.readdirSync( __dirname + "/../main/" ) | ||
.map( file => `main/${file}` ); | ||
|
||
QUnit.test( "files", assert => { | ||
assert.true( files.length > 5, "found files" ); | ||
assert.deepEqual( | ||
files.filter( file => file.endsWith( ".js" ) ), | ||
files, | ||
"js files" | ||
); | ||
} ); | ||
|
||
QUnit.test( "index.html", assert => { | ||
const contents = fs.readFileSync( __dirname + "/../index.html", "utf8" ); | ||
files.forEach( file => { | ||
assert.true( contents.includes( file ), file ); | ||
} ); | ||
} ); | ||
|
||
QUnit.test( "test-on-node", assert => { | ||
const raw = fs.readFileSync( __dirname + "/../../Gruntfile.js", "utf8" ); | ||
const contents = raw.match( /test-on-node.*?\{.*?\}/s )[ 0 ]; | ||
|
||
files.forEach( file => { | ||
assert.true( contents.includes( file ), file ); | ||
} ); | ||
} ); | ||
|
||
QUnit.test( "mozjs", assert => { | ||
const contents = fs.readFileSync( __dirname + "/../mozjs.js", "utf8" ); | ||
files.forEach( file => { | ||
assert.true( contents.includes( file ), file ); | ||
} ); | ||
} ); | ||
|
||
QUnit.test( "Web Worker", assert => { | ||
const contents = fs.readFileSync( __dirname + "/../webWorker-worker.js", "utf8" ); | ||
files.forEach( file => { | ||
assert.true( contents.includes( file ), file ); | ||
} ); | ||
} ); | ||
} ); | ||
|
||
QUnit.module( "test/**.html", () => { | ||
|
||
// Get a list of the HTML files, including in subdirectories (e.g. "test/reporter-html/"). | ||
// Ignore file names containing "--", which are subresources (e.g. iframes). | ||
const files = glob( "**/*.html", { | ||
cwd: __dirname + "/../", | ||
filesOnly: true | ||
} ) | ||
.filter( file => !file.includes( "--" ) ) | ||
.map( file => `test/${file}` ); | ||
|
||
QUnit.test( "files", assert => { | ||
assert.true( files.length > 5, "found files" ); | ||
} ); | ||
|
||
QUnit.test( "grunt-contrib-qunit", assert => { | ||
const raw = fs.readFileSync( __dirname + "/../../Gruntfile.js", "utf8" ); | ||
const contents = raw.match( /@HTML_FILES.*?\[.*?\]/s )[ 0 ]; | ||
|
||
files.forEach( file => { | ||
assert.true( contents.includes( file ), file ); | ||
} ); | ||
} ); | ||
} ); | ||
} ); | ||
|
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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