prism/tests/run.js

31 lines
871 B
JavaScript
Raw Normal View History

// @ts-check
2021-04-18 04:26:40 +08:00
'use strict';
2015-06-02 02:39:11 +08:00
2021-04-18 04:26:40 +08:00
const TestDiscovery = require('./helper/test-discovery');
const TestCase = require('./helper/test-case');
const path = require('path');
const { argv } = require('yargs');
2015-06-02 02:39:11 +08:00
const testSuite =
(argv.language)
2021-10-20 01:34:41 +08:00
? TestDiscovery.loadSomeTests(argv.language)
// load complete test suite
2021-10-20 01:34:41 +08:00
: TestDiscovery.loadAllTests();
2015-06-02 02:39:11 +08:00
const update = !!argv.update;
2015-06-02 02:39:11 +08:00
// define tests for all tests in all languages in the test suite
2021-10-20 01:34:41 +08:00
for (const [languageIdentifier, files] of testSuite) {
describe("Testing language '" + languageIdentifier + "'", function () {
this.timeout(10000);
2015-06-02 02:39:11 +08:00
2021-10-20 01:34:41 +08:00
for (const filePath of files) {
const fileName = path.basename(filePath, path.extname(filePath));
2015-10-10 18:48:26 +08:00
2021-10-20 01:34:41 +08:00
it(" should pass test case '" + fileName + "'", function () {
TestCase.runTestCase(languageIdentifier, filePath, update ? 'update' : 'insert');
});
}
});
}