-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
459492d
commit 891034c
Showing
14 changed files
with
627 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -7,7 +7,7 @@ os: | |
node_js: | ||
- 10 | ||
- 8 | ||
- 6.2.0 | ||
- 6 | ||
|
||
cache: | ||
directories: | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,18 @@ | ||
"use strict" | ||
|
||
const clone = require("./clone.js") | ||
const copy = require("./copy.js") | ||
|
||
function bootstrap() { | ||
return clone() | ||
.then(copy) | ||
// TODO remove: | ||
// temporary measure and can be safily removed once | ||
// the `dynamic import` test PR is merged into test262 | ||
// -- BEGIN | ||
// .then(clone.dynamicImport) | ||
// .then(copy.dynamicImport) | ||
// -- END | ||
} | ||
|
||
module.exports = bootstrap |
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,46 @@ | ||
"use strict" | ||
|
||
const execa = require("execa") | ||
const trash = require("trash") | ||
const { resolve } = require( "path") | ||
|
||
const rootPath = resolve(".") | ||
const test262Path = resolve(rootPath, "test/_external/test262") | ||
const test262RepoPath = resolve(test262Path, ".repo") | ||
// const test262RepoGitPath = resolve(test262RepoPath, ".git") | ||
|
||
function run(cwd, file, args) { | ||
return execa(file, args, { | ||
cwd, | ||
reject: false | ||
}) | ||
} | ||
|
||
function clone() { | ||
return trash(test262RepoPath) | ||
.then(() => | ||
run(test262Path, "git", ["--version"]) | ||
) | ||
.then(() => | ||
run(test262Path, "git", ["clone", "--depth", "1", "https://github.com/tc39/test262.git", ".repo"]) | ||
) | ||
} | ||
|
||
// TODO remove: | ||
// this is just a temporary measure and can be safily removed once | ||
// the `dynamic import` test PR is merged into test262 | ||
// -- BEGIN | ||
clone.dynamicImport = function () { | ||
return run( | ||
test262RepoPath, "git", ["fetch", "origin", "--depth", "1", "pull/1588/head:dynamic-import"] | ||
) | ||
.then(() => | ||
run(test262RepoPath, "git", ["checkout", "dynamic-import"]) | ||
) | ||
// .then(() => | ||
// trash(test262RepoGitPath) | ||
// ) | ||
// -- END | ||
} | ||
|
||
module.exports = clone |
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,46 @@ | ||
"use strict" | ||
|
||
const trash = require("trash") | ||
const { resolve } = require("path") | ||
const { copy } = require("fs-extra") | ||
|
||
const rootPath = resolve(".") | ||
const test262RepoPath = resolve(rootPath, "test/_external/test262/.repo") | ||
const testPath = resolve(rootPath, "test/_external/test262/.test") | ||
|
||
const testDirs = [ | ||
"test/language/export", | ||
"test/language/import", | ||
"test/language/module-code", | ||
"harness" | ||
] | ||
|
||
function copyTests() { | ||
return trash(testPath) | ||
.then(() => | ||
Promise.all( | ||
testDirs.map((testDir) => | ||
copy(resolve(test262RepoPath, testDir), resolve(testPath, testDir)) | ||
) | ||
) | ||
) | ||
} | ||
|
||
// TODO remove: | ||
// temporary measure and can be safily removed once | ||
// the `dynamic import` test PR is merged into test262 | ||
// -- BEGIN | ||
const testDirsDynamicImport = [ | ||
"test/language/module-code/dynamic-import" | ||
] | ||
|
||
copyTests.dynamicImport = function () { | ||
return Promise.all( | ||
testDirsDynamicImport.map((testDirDynamicImport) => | ||
copy(resolve(test262RepoPath, testDirDynamicImport), resolve(testPath, testDirDynamicImport)) | ||
) | ||
) | ||
} | ||
// -- END | ||
|
||
module.exports = copyTests |
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 @@ | ||
"use strict" | ||
|
||
const globby = require("globby") | ||
const { resolve } = require("path") | ||
|
||
const testPath = resolve(__dirname, "../../test/_external/test262/.test") | ||
|
||
exports.getTestFiles = function getTestFiles() { | ||
return globby( | ||
[ | ||
"test/language/export/**/*.js", | ||
"test/language/import/**/*.js", | ||
"test/language/module-code/**/*.js" | ||
], | ||
{ | ||
absolute: true, | ||
cwd: testPath | ||
} | ||
) | ||
} | ||
|
||
exports.getHarnessFiles = function getHarnessFiles() { | ||
return globby( | ||
[ | ||
"harness/*.js" | ||
], | ||
{ | ||
absolute: true, | ||
cwd: testPath | ||
} | ||
) | ||
} |
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 @@ | ||
import { createContext, Script } from "vm" | ||
import { basename, resolve } from "path" | ||
import test262Parser from "test262-parser" | ||
import fs from "fs-extra" | ||
import globby from "globby" | ||
import { stdout } from "process" | ||
|
||
// TODO: | ||
const testPath = resolve("../test/_external/test262/.test") | ||
|
||
const harnessFiles = [ | ||
"assert.js", | ||
"sta.js", | ||
"doneprintHandle.js", | ||
"fnGlobalObject.js" | ||
] | ||
|
||
function getHarnessFiles() { | ||
return globby.sync( | ||
[ | ||
"harness/*.js" | ||
], | ||
{ | ||
absolute: true, | ||
cwd: testPath | ||
} | ||
) | ||
} | ||
|
||
const sandbox = createContext(global) | ||
|
||
export default function harnessContext() { | ||
getHarnessFiles() | ||
.filter((file) => | ||
harnessFiles.includes(basename(file)) | ||
) | ||
.map((filename) => | ||
fs.readFileSync(filename, "utf-8") | ||
) | ||
.forEach((rawHarness) => { | ||
const { contents } = test262Parser.parseFile(rawHarness) | ||
new Script(contents).runInContext(sandbox) | ||
}) | ||
} |
Oops, something went wrong.