Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions .eslintrc.js

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ package-lock.json
dist
yarn-error.log
scratch
.lambdatest
.lambdatest
*.tsbuildinfo
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Changed
- Updated various dependencies, including webdriverio, rspack, webpack-dev-server and eslint. #TINYMCE-14572
- Changed the default bundler to rspack. #TINYMCE-14649

### Fixed
- A rejected promise or exception in a `before` or `after` hook aborted the entire run instead of being reported as a failure. #TINYMCE-14759
- An error arriving after the test that caused it had finished was silently discarded, it is now reported against the most recent test. #TINYMCE-14759
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ standardProperties()

timestamps {
tinyPods.nodeBrowser(
tag: '20',
tag: '24',
resourceRequestMemory: '4Gi',
resourceLimitMemory: '4Gi'
) {
Expand Down
74 changes: 74 additions & 0 deletions eslint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import type { Linter } from 'eslint';
import * as js from '@eslint/js';
import * as tseslint from '@typescript-eslint/eslint-plugin';
import * as espree from 'espree';
import * as globals from 'globals';

const config: Linter.Config[] = [
{
ignores: ['**/lib/**', '**/dist/**', '**/scratch/**']
},
...(tseslint.configs['flat/recommended'] as Linter.Config[]),
{
languageOptions: {
globals: {
...globals.browser
}
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-unused-vars': [ 'warn', {
vars: 'all',
args: 'after-used',
ignoreRestSiblings: true,
argsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_'
}],
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/explicit-module-boundary-types': [ 'error', { 'allowArgumentsExplicitlyTypedAsAny': true } ],

'arrow-spacing': 'error',
'no-multi-spaces': [ 'error', { ignoreEOLComments: true }],
'no-multiple-empty-lines': [ 'error', { 'max': 1 } ],
'object-shorthand': 'error',
'quotes': [ 'error', 'single', { 'allowTemplateLiterals': true } ],
'space-before-function-paren': [ 'error', { anonymous: 'always', named: 'never' } ],
'semi': 'error',
'spaced-comment': 'error',
'space-infix-ops': 'error',
'space-unary-ops': 'error',
'space-before-blocks': 'error',
}
},
{
// Plain JS grunt tasks, previously governed by their own root:true .eslintrc.js
// rather than the TypeScript config above, so every typescript-eslint rule
// picked up from the shared config above needs to be turned back off here.
files: ['modules/server/tasks/**/*.js'],
languageOptions: {
parser: espree,
ecmaVersion: 11,
sourceType: 'commonjs',
globals: {
...globals.node
}
},
rules: {
...js.configs.recommended.rules,
...Object.fromEntries(Object.keys(tseslint.rules).map((name) => [ `@typescript-eslint/${name}`, 'off' ])),
'no-var': 'error',
'prefer-const': 'error',
'curly': [ 'error', 'multi-line' ],
'object-curly-spacing': 'off',
'array-bracket-spacing': 'off',
'space-before-function-paren': 'off',
'no-trailing-spaces': 'off',
'indent': [ 'error', 2 ],
'max-len': 'off',
'no-prototype-builtins': 'off'
}
}
];

export default config;
1 change: 0 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"npmClient": "yarn",
"useWorkspaces": true,
"version": "16.2.0",
"publish": {
"push": false
Expand Down
4 changes: 2 additions & 2 deletions modules/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"scripts": {
"prepublishOnly": "tsc -b",
"build": "yarn prepublishOnly",
"test": "mocha -r esm 'lib/test/ts/**/*Test.js'",
"test": "mocha -r tsx/cjs 'lib/test/ts/**/*Test.js'",
"buildAndTest": "yarn prepublishOnly && yarn test"
},
"dependencies": {
"@ephox/bedrock-common": "^16.0.0",
"@ephox/dispute": "^1.0.3"
"@ephox/dispute": "^1.0.16"
},
"main": "./lib/main/ts/api/Main.js",
"module": "./lib/main/ts/api/Main.js",
Expand Down
2 changes: 1 addition & 1 deletion modules/client/src/main/ts/api/Assert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const throwsError = (message: TestLabel, f: () => void, expected?: string): void
const succeeds = (message: TestLabel, f: () => void): void => {
try {
f();
} catch (e) {
} catch (_e) {
throw new Error('Expected function to not throw, but it did.\n' + TestLabel.asString(message));
}
};
Expand Down
2 changes: 2 additions & 0 deletions modules/client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"compilerOptions": {
"moduleResolution": "node",
"ignoreDeprecations": "6.0",
"skipLibCheck": true,
Comment thread
TheSpyder marked this conversation as resolved.
"strict": true,
"noUnusedLocals": true,
"useUnknownInCatchVariables": false,
Expand Down
4 changes: 2 additions & 2 deletions modules/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"prepublishOnly": "tsc -b",
"build": "yarn prepublishOnly",
"test": "mocha -r esm 'lib/test/ts/**/*Test.js'",
"test": "mocha -r tsx/cjs 'lib/test/ts/**/*Test.js'",
"buildAndTest": "yarn prepublishOnly && yarn test"
},
"main": "./lib/main/ts/api/Main.js",
Expand All @@ -21,6 +21,6 @@
"registry": "https://registry.npmjs.org"
},
"dependencies": {
"diff": "^5.0.0"
"diff": "^9.0.0"
}
}
6 changes: 5 additions & 1 deletion modules/common/src/main/ts/api/Failure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ const cleanStack = (error: Error, linesToRemove = 1) => {
};

export const normalizeError = (err: TestThrowable): TestError => {
if (typeof err === 'string') {
if (err === null || err === undefined) {
const error = new Error('Test failed with no error (rejected with ' + String(err) + ')');
error.stack = cleanStack(error, 2);
return error;
} else if (typeof err === 'string') {
// Create an error object, but strip the stack of the 2 latest calls as it'll
// just be this function and the previous function that called this (ie asyncTest)
const error = new Error(err);
Expand Down
12 changes: 8 additions & 4 deletions modules/common/src/main/ts/api/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,23 @@ export {
Global,
TestError,
LoggedError,
ErrorData,
Reporter,
TestLabel,
TestLogs,
TestThrowable,
Type,

HookType,
RunnableState
};

export type {
ErrorData,
TestThrowable,

Context,
ExecuteFn,
Hook,
HookType,
Runnable,
RunnableState,
Suite,
Test,
TestGlobals
Expand Down
6 changes: 3 additions & 3 deletions modules/common/src/main/ts/api/TestTypes.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { TestError } from './TestError';
import { TestLabel } from './TestLabel';

export const enum HookType {
export enum HookType {
Before = 'before',
BeforeEach = 'beforeEach',
After = 'after',
AfterEach = 'afterEach'
}

export const enum RunnableState {
export enum RunnableState {
NotRun = 'notrun',
Passed = 'passed',
Skipped = 'skipped',
Expand Down Expand Up @@ -76,7 +76,7 @@ export interface Runnable extends Common<Runnable> {
readonly _onChange: (type: 'retries' | 'slow' | 'timeout', callback: (value: number) => void) => () => void;
}

// eslint-disable-next-line @typescript-eslint/no-empty-interface
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface Hook extends Runnable {}

export interface Test extends Runnable {
Expand Down
2 changes: 1 addition & 1 deletion modules/common/src/main/ts/api/Type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ const isType = <T>(type: string) => (value: any): value is T => {
};

export const isString = isType<string>('string');
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types
export const isObject = isType<Object>('object');
2 changes: 2 additions & 0 deletions modules/common/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"compilerOptions": {
"moduleResolution": "node",
"ignoreDeprecations": "6.0",
"skipLibCheck": true,
"strict": true,
"noUnusedLocals": true,
"useUnknownInCatchVariables": false,
Expand Down
14 changes: 7 additions & 7 deletions modules/runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
"scripts": {
"prepublishOnly": "tsc -b && rollup --config",
"build": "yarn prepublishOnly",
"test": "mocha -r esm 'lib/test/ts/**/*Test.js'",
"test": "mocha -r tsx/cjs 'lib/test/ts/**/*Test.js'",
"buildAndTest": "yarn prepublishOnly && yarn test"
},
"dependencies": {
"@ephox/bedrock-common": "^16.0.0",
"jquery": "^3.4.1",
"querystringify": "^2.1.1"
"jquery": "^4.0.0",
"querystringify": "^2.2.0"
},
"devDependencies": {
"@types/diff": "^5.0.0",
"@types/jquery": "^3.5.3",
"@types/querystringify": "^2.0.0",
"rollup": "^4.30.1",
"@types/diff": "^8.0.0",
"@types/jquery": "^4.0.1",
"@types/querystringify": "^2.0.2",
"rollup": "^4.62.4",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-sourcemaps": "^0.6.3",
Expand Down
7 changes: 3 additions & 4 deletions modules/runner/src/main/ts/core/Utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Suite, Test } from '@ephox/bedrock-common';
import sourceMappedStackTrace from 'sourcemapped-stacktrace';

// eslint-disable-next-line @typescript-eslint/no-empty-function

export const noop = (): void => {};

export const makeQueryParams = (session: string, offset: number, failed: number, skipped: number, retry: number): string => {
Expand Down Expand Up @@ -47,7 +46,7 @@ export const mapStackTrace = (stack: string | undefined): Promise<string> => new
// In that case lets just return the original stack instead.
try {
sourceMappedStackTrace.mapStackTrace(stack, (stack: string[]) => resolve(stack.join('\n')));
} catch (e) {
} catch (_e) {
resolve(stack);
}
} else {
Expand All @@ -58,7 +57,7 @@ export const mapStackTrace = (stack: string | undefined): Promise<string> => new
export const setStack = (error: Error, stack: string | undefined): void => {
try {
error.stack = stack;
} catch (err) {
} catch (_err) {
// Do nothing
}
};
3 changes: 1 addition & 2 deletions modules/runner/src/test/ts/TestUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// eslint-disable-next-line @typescript-eslint/no-empty-function
export const noop = (): void => {};
export const noop = (): void => {};

export const range = <T>(count: number, fn: (idx: number) => T): T[] => {
const r: T[] = [];
Expand Down
6 changes: 3 additions & 3 deletions modules/runner/src/test/ts/core/UtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ describe('Utils.makeQueryParams', () => {
});

it('should always include a session, offset and failed params if offset > 0', () => {
fc.assert(fc.property(fc.hexaString(), fc.integer(1, 1000), fc.nat(), (session, offset, failed) => {
fc.assert(fc.property(fc.string(), fc.integer({ min: 1, max: 1000 }), fc.nat(), (session, offset, failed) => {
assert.equal(Utils.makeQueryParams(session, offset, failed, 0, 0), '?session=' + session + '&offset=' + offset + '&failed=' + failed);
}));
});

it('should always include a session, offset and failed params if retries > 0', () => {
fc.assert(fc.property(fc.hexaString(), fc.integer(1, 1000), fc.nat(), (session, retries, failed) => {
fc.assert(fc.property(fc.string(), fc.integer({ min: 1, max: 1000 }), fc.nat(), (session, retries, failed) => {
assert.equal(Utils.makeQueryParams(session, 0, failed, 0, retries), '?session=' + session + '&offset=' + 0 + '&failed=' + failed + '&retry=' + retries);
}));
});
Expand All @@ -45,7 +45,7 @@ describe('Utils.formatElapsedTime', () => {
it('should be larger than 0', () => {
const now = new Date();
const fiveSeconds = new Date(now.getTime() + 5000);
fc.assert(fc.property(fc.date({ max: now }), fc.date({ min: fiveSeconds }), (start, end) => {
fc.assert(fc.property(fc.date({ max: now, noInvalidDate: true }), fc.date({ min: fiveSeconds, noInvalidDate: true }), (start, end) => {
const result = parseFloat(Utils.formatElapsedTime(start.getTime(), end.getTime()));
assert.isAtLeast(result, 5.0);
}));
Expand Down
6 changes: 3 additions & 3 deletions modules/runner/src/test/ts/reporter/ReporterTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe('Reporter.test', () => {
beforeEach(() => reset());

it('should report the session id, number tests, file and name on start', () => {
return fc.assert(fc.asyncProperty(fc.hexaString(), fc.asciiString(), fc.integer(offset), (fileName, testName, testCount) => {
return fc.assert(fc.asyncProperty(fc.string(), fc.string(), fc.integer({ max: offset }), (fileName, testName, testCount) => {
reset(0);
const test = reporter.test(fileName + 'Test.ts', testName, testCount);
test.start();
Expand Down Expand Up @@ -107,7 +107,7 @@ describe('Reporter.test', () => {
});

it('should report the session id, file, name, passed state and time on a skipped test', () => {
return fc.assert(fc.asyncProperty(fc.hexaString(), fc.asciiString(), fc.asciiString(), fc.integer(offset), (fileName, testName, skippedMessage, testCount) => {
return fc.assert(fc.asyncProperty(fc.string(), fc.string(), fc.string(), fc.integer({ max: offset }), (fileName, testName, skippedMessage, testCount) => {
reset();
const test = reporter.test(fileName + 'Test.ts', testName, testCount);
test.start();
Expand Down Expand Up @@ -137,7 +137,7 @@ describe('Reporter.test', () => {
});

it('should report the session id, file, name, passed state, time and error on a test failure', () => {
return fc.assert(fc.asyncProperty(fc.hexaString(), fc.asciiString(), fc.integer(offset), (fileName, testName, testCount) => {
return fc.assert(fc.asyncProperty(fc.string(), fc.string(), fc.integer({ max: offset }), (fileName, testName, testCount) => {
reset();
const test = reporter.test(fileName + 'Test.ts', testName, testCount);
const error = LoggedError.loggedError(new Error('Failed'), [ 'Log Message' ]);
Expand Down
Loading
Loading