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 #12397 from Automattic/vkarpov15/deno
Deno support
- Loading branch information
Showing
17 changed files
with
222 additions
and
116 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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
'use strict'; | ||
|
||
import { createRequire } from "https://deno.land/std/node/module.ts"; | ||
|
||
// Workaround for Mocha getting terminal width, which currently requires `--unstable` | ||
Object.defineProperty(process.stdout, 'getWindowSize', { | ||
value: function() { | ||
return [75, 40]; | ||
} | ||
}); | ||
|
||
import { parse } from "https://deno.land/std/flags/mod.ts" | ||
const args = parse(Deno.args); | ||
|
||
const require = createRequire(import.meta.url); | ||
|
||
const Mocha = require('mocha'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const mocha = new Mocha({ | ||
timeout: 8000, | ||
...(args.g ? { fgrep: '' + args.g } : {}) | ||
}); | ||
|
||
const testDir = 'test'; | ||
const files = fs.readdirSync(testDir). | ||
concat(fs.readdirSync(path.join(testDir, 'docs')).map(file => path.join('docs', file))). | ||
concat(fs.readdirSync(path.join(testDir, 'helpers')).map(file => path.join('helpers', file))); | ||
|
||
const ignoreFiles = new Set(['browser.test.js']); | ||
|
||
for (const file of files) { | ||
if (!file.endsWith('.test.js') || ignoreFiles.has(file)) { | ||
continue; | ||
} | ||
|
||
mocha.addFile(path.join(testDir, file)); | ||
} | ||
|
||
mocha.run(function(failures) { | ||
process.exitCode = failures ? 1 : 0; // exit with non-zero status if there were failures | ||
process.exit(process.exitCode); | ||
}); |
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
Oops, something went wrong.