Skip to content

Commit

Permalink
Merge pull request #4369 from preactjs/chore/test-types-and-warnings
Browse files Browse the repository at this point in the history
chore: test types and warnings
  • Loading branch information
rschristian authored May 2, 2024
2 parents 4ab4b99 + c38e437 commit d18ac9f
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 12 deletions.
4 changes: 2 additions & 2 deletions compat/test/browser/testUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ export function getSymbol(name, fallback) {
// eslint-disable-next-line
if (
Function.prototype.toString
.call(eval('Symbol.for'))
.call((0, eval)('Symbol.for'))
.match(/\[native code\]/)
) {
// Concatenate these string literals to prevent the test
// harness and/or Babel from modifying the symbol value.
// eslint-disable-next-line
out = eval('Sym' + 'bol.for("' + name + '")');
out = (0, eval)('Sym' + 'bol.for("' + name + '")');
}
} catch (e) {}

Expand Down
47 changes: 41 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@
"@types/chai": "^4.1.2",
"@types/mocha": "^5.0.0",
"@types/node": "^14.14.10",
"@types/sinon": "^9.0.11",
"babel-plugin-istanbul": "^6.0.0",
"babel-plugin-transform-async-to-promises": "^0.8.15",
"babel-plugin-transform-rename-properties": "0.1.0",
Expand Down
2 changes: 1 addition & 1 deletion test/browser/getDomSibling.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { setupScratch, teardown } from '../_util/helpers';
/** @jsx createElement */

describe('getDomSibling', () => {
/** @type {import('../../src/internal').PreactElement} */
/** @type {HTMLDivElement} */
let scratch;

const getRoot = dom => dom._children;
Expand Down
17 changes: 14 additions & 3 deletions test/extensions.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
declare module Chai {
export interface Assertion {
equalNode(node: Node | null, message?: string): void;
declare global {
namespace Chai {
interface Assertion {
equalNode(node: Node | null, message?: string): void;
called: Assertion;
calledOnce: Assertion;
calledTwice: Assertion;
calledWith(...args: any[]): Assertion;
calledWithMatch(...args: Record<string, unknown>[]): Assertion;
}
}
var expect: Chai.ExpectStatic;
var sinon: Sinon;
}

export {};

0 comments on commit d18ac9f

Please sign in to comment.