diff --git a/package.json b/package.json index 0f777354a..9ff1167af 100644 --- a/package.json +++ b/package.json @@ -38,15 +38,15 @@ "scripts": { "test": "npm-run-all -s test:*", "watch:test": "npm-run-all -p watch:test:*", - "test:common": "mocha --exit --require ./test/setup/mocha.js src/common/**/*.mocha.{ts,tsx}", - "test:client": "mocha --exit --require ./test/setup/mocha.js src/client/**/*.mocha.{ts,tsx}", - "test:server": "mocha --exit --require ./test/setup/mocha.js src/server/**/*.mocha.ts", + "test:common": "mocha --exit --require ./test/setup/mocha.js 'src/common/**/*.mocha.{ts,tsx}'", + "test:client": "mocha --exit --require ./test/setup/mocha.js 'src/client/**/*.mocha.{ts,tsx}' --file 'src/client/utils/test-utils/jsdom-setup.ts'", + "test:server": "mocha --exit --require ./test/setup/mocha.js 'src/server/**/*.mocha.ts'", "test:client-types": "npm run tsc -- --noEmit -p src/client/tsconfig.json", "test:size": "size-limit", - "watch:test:common": "npm run test:common -- --watch --watch-extensions ts,tsx", - "watch:test:client": "npm run test:client -- --watch --watch-extensions ts,tsx", - "watch:test:server": "npm run test:server -- --watch --watch-extensions ts,tsx", - "test-watcher": "mocha --require ./test/setup/mocha.js --watch --watch-extensions ts,tsx", + "watch:test:common": "npm run test:common -- --watch --watch-files 'src/common/**/*.mocha.ts'", + "watch:test:client": "npm run test:client -- --watch --watch-files 'src/client/**/*.mocha.tsx' --watch-files 'src/client/**/*.mocha.ts'", + "watch:test:server": "npm run test:server -- --watch --watch-files 'src/server/**/*.mocha.ts'", + "test-watcher": "mocha --require ./test/setup/mocha.js --watch", "start": "./bin/turnilo", "start:dev": "NODE_ENV=dev-hmr ./bin/turnilo", "start:examples": "npm run start -- --examples", diff --git a/src/client/components/notifications/notifications.mocha.tsx b/src/client/components/notifications/notifications.mocha.tsx deleted file mode 100644 index 18c0e4036..000000000 --- a/src/client/components/notifications/notifications.mocha.tsx +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2015-2016 Imply Data, Inc. - * Copyright 2017-2019 Allegro.pl - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { expect } from "chai"; -import React from "react"; -import * as TestUtils from "react-dom/test-utils"; - -import { findDOMNode, renderIntoDocument } from "../../utils/test-utils"; - -import { Notifications } from "./notifications"; - -describe("Notifications", () => { - it("adds the correct class", () => { - var renderedComponent = renderIntoDocument( - - ); - - expect(TestUtils.isCompositeComponent(renderedComponent), "should be composite").to.equal(true); - expect(findDOMNode(renderedComponent).className, "should contain class").to.contain("notifications"); - }); - -}); diff --git a/src/client/utils/test-utils/index.ts b/src/client/utils/test-utils/index.ts index e6ca7e950..3c3396325 100644 --- a/src/client/utils/test-utils/index.ts +++ b/src/client/utils/test-utils/index.ts @@ -19,7 +19,6 @@ var ExecutionEnvironment = require("../../../../node_modules/fbjs/lib/ExecutionEnvironment"); ExecutionEnvironment.canUseDOM = true; -import "./jsdom-setup"; import "./require-extensions"; export * from "./mock-require-ensure"; diff --git a/src/common/models/split/split.mocha.ts b/src/common/models/split/split.mocha.ts index 7a6e28097..9d67335d7 100644 --- a/src/common/models/split/split.mocha.ts +++ b/src/common/models/split/split.mocha.ts @@ -48,5 +48,8 @@ describe("Split", () => { expect(formatValueStub.calledWith(42, timezone)).to.be.true; }); + afterEach(() => { + formatValueStub.restore(); + }); }); }); diff --git a/src/common/utils/formatter/formatter.mocha.ts b/src/common/utils/formatter/formatter.mocha.ts index 8974c9fac..6bb0dd213 100644 --- a/src/common/utils/formatter/formatter.mocha.ts +++ b/src/common/utils/formatter/formatter.mocha.ts @@ -69,6 +69,7 @@ describe("General", () => { const filterClause = FormatterFixtures.fixedTimeFilter(start, end); formatFilterClause(DimensionFixtures.time(), filterClause, Timezone.UTC); expect(formatTimeRange.calledWith({ start, end }, Timezone.UTC)).to.equal(true); + formatTimeRange.restore(); }); it("formats number", () => {