Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#402] Fix tests doesn't run correctly #403

Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:

jobs:
build-and-test:

timeout-minutes: 5
runs-on: ubuntu-latest

strategy:
Expand Down
12 changes: 0 additions & 12 deletions .mocharc.json

This file was deleted.

9 changes: 5 additions & 4 deletions modules/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@
"lint": "eslint `find src -name '*.ts'`"
},
"dependencies": {
"@iabtechlabtcf/core": "1.5.7"
"@iabtechlabtcf/core": "1.5.8"
},
"devDependencies": {
"@types/node": "^17.0.18",
"@types/node": "18.17.4",
"@typescript-eslint/eslint-plugin": "^2.10.0",
"@typescript-eslint/parser": "^5.12.0",
"eslint": "6.8.0",
"source-map-support": "^0.5.12",
"ts-node": "^10.5.0",
"typescript": "^4.5.5"
"ts-node": "10.9.1",
"typedoc": "0.24.8",
"typescript": "4.9.5"
},
"eslintIgnore": [
"lib"
Expand Down
5 changes: 3 additions & 2 deletions modules/cmpapi/.mocharc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
"require": [
"ts-node/register",
"jsdom-global/register",
"source-map-support/register"
"source-map-support/register",
"test/hook.mjs"
],
"node-option": [
"experimental-specifier-resolution=node",
"loader=ts-node/esm"
],
"spec": "./test/Root.test.ts"
"spec": "./test/**/*.test.ts"
}
11 changes: 11 additions & 0 deletions modules/cmpapi/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// eslint-disable-next-line max-len
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars, no-unused-vars, @typescript-eslint/no-var-requires */
interface Window {
__tcfapi: (
command: any,
version: any,
callback: (...params: any) => void,
...param: any
) => void;

}
10 changes: 5 additions & 5 deletions modules/cmpapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"@iabtechlabtcf/core": ">=1.0.0"
},
"devDependencies": {
"@iabtechlabtcf/stub": "1.5.7",
"@iabtechlabtcf/testing": "1.5.7",
"@iabtechlabtcf/stub": "1.5.8",
"@iabtechlabtcf/testing": "1.5.8",
"@istanbuljs/nyc-config-typescript": "^0.1.3",
"@types/mocha": "^9.1.0",
"@types/sinon": "10.0.11",
Expand All @@ -56,9 +56,9 @@
"sinon-chai": "3.7.0",
"source-map-support": "^0.5.12",
"terser": "^4.8.1",
"ts-node": "^10.5.0",
"typedoc": "^0.22.11",
"typescript": "4.5.5"
"ts-node": "10.9.1",
"typedoc": "0.24.8",
"typescript": "4.9.5"
},
"eslintIgnore": [
"lib"
Expand Down
40 changes: 0 additions & 40 deletions modules/cmpapi/test/Root.test.ts

This file was deleted.

19 changes: 19 additions & 0 deletions modules/cmpapi/test/hook.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {XMLHttpTestTools} from '@iabtechlabtcf/testing';
import {GVL} from "@iabtechlabtcf/core";
import {CmpApiModel} from "../src/index.js";

GVL.baseUrl = 'http://sweetcmp.mgr.consensu.org';
/**
* MochaHooks.
* This object specifies hooks that must run before or after every test in every file.
* https://mochajs.org/#root-hook-plugins
*/
export const mochaHooks = {
beforeEach(done) {
CmpApiModel.reset();
XMLHttpTestTools.beforeEach();
GVL.emptyCache();

done();
},
};
Loading
Loading