prism/tests/run.js

37 lines
1.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// @ts-check
'use strict';
const TestDiscovery = require('./helper/test-discovery');
const TestCase = require('./helper/test-case');
const path = require('path');
const { argv } = require('yargs');
const testSuite =
(argv.language)
? TestDiscovery.loadSomeTests(__dirname + '/languages', argv.language)
// load complete test suite
: TestDiscovery.loadAllTests(__dirname + '/languages');
const update = !!argv.update;
// define tests for all tests in all languages in the test suite
for (const language in testSuite) {
if (!testSuite.hasOwnProperty(language)) {
continue;
}
(function (language, testFiles) {
describe("Testing language '" + language + "'", function () {
this.timeout(10000);
for (const filePath of testFiles) {
const fileName = path.basename(filePath, path.extname(filePath));
it(" should pass test case '" + fileName + "'", function () {
TestCase.runTestCase(language, filePath, update ? 'update' : 'insert');
});
}
});
}(language, testSuite[language]));
}