feat: added tests/typescript to test supported TS examples (#6775)

* feat: added `tests/typescript` to test supported TS examples

* fix: update the test name, description, and output

* chore: remove unused imports in `test_tasks.js`

* fix: wrap README line at 80 characters

* fix: implemented `different_user_input.ts` feedback

* fix: correct mistaken comments

* chore: rename `./eslintrc.json` to `./eslintrc.js`

* feat: added linting for tests/typescript

* chore: cleanup eslintrc lines over 80 characters

* fix: updated `.eslintrc.js` to provide an override for linting itself

* fix: updated tests to build to the `build` directory

* feat: updated `gulp format` to handle formatting `.eslintrc.js`

* fix: updated `.eslintrc.js` to align with both formatter and linter

* fix: updated config comment wording

* fix: removed quotes for valid identifiers

* Revert "fix: removed quotes for valid identifiers"

  This reverts commit 03eff91aea1468e503bc79a90fb139914d3f39d2.
This commit is contained in:
Blake Thomas Williams
2023-02-10 11:12:18 -06:00
committed by GitHub
parent 8386024e44
commit 13fe6eeccf
10 changed files with 348 additions and 170 deletions

View File

@@ -733,7 +733,8 @@ function cleanBuildDir() {
function format() {
return gulp.src([
'core/**/*.js', 'core/**/*.ts',
'blocks/**/*.js', 'blocks/**/*.ts'
'blocks/**/*.js', 'blocks/**/*.ts',
'.eslintrc.js'
], {base: '.'})
.pipe(clangFormatter.format('file', clangFormat))
.pipe(gulp.dest('.'));

View File

@@ -38,6 +38,9 @@ exports.TYPINGS_BUILD_DIR = path.join(exports.BUILD_DIR, 'declarations');
// Matches the value in tsconfig.json: outDir
exports.TSC_OUTPUT_DIR = path.join(exports.BUILD_DIR, 'src');
// Directory for files generated by compiling test code.
exports.TEST_TSC_OUTPUT_DIR = path.join(exports.BUILD_DIR, 'tests');
// Directory in which to assemble (and from which to publish) the
// blockly npm package.
exports.RELEASE_DIR = 'dist';

View File

@@ -17,8 +17,7 @@ const path = require('path');
const {execSync} = require('child_process');
const rimraf = require('rimraf');
const buildTasks = require('./build_tasks');
const {BUILD_DIR, RELEASE_DIR} = require('./config');
const {RELEASE_DIR, TEST_TSC_OUTPUT_DIR} = require('./config');
const {runMochaTestsInBrowser} = require('../../tests/mocha/webdriver.js');
const {runGeneratorsInBrowser} = require('../../tests/generators/webdriver.js');
@@ -371,6 +370,16 @@ function advancedCompileInBrowser() {
return runTestTask('advanced_compile_in_browser', runCompileCheckInBrowser);
}
/**
* Verify the built Blockly type definitions compile with the supported
* TypeScript examples included in `./tests/typescript`.
* @returns {Promise} Asynchronous result.
*/
function typeDefinitions() {
return runTestCommand('type_definitions',
`tsc -p ./tests/typescript/tsconfig.json -outDir ${TEST_TSC_OUTPUT_DIR}`);
}
// Run all tests in sequence.
const tasks = [
eslint,
@@ -381,6 +390,7 @@ const tasks = [
mocha,
generators,
node,
typeDefinitions,
// Make sure these two are in series with each other
advancedCompile,
advancedCompileInBrowser