From 6a31ed5b3690620d19fb2c6ed4c8d1084207ffa3 Mon Sep 17 00:00:00 2001 From: Maxime Thirouin Date: Sat, 5 Mar 2016 23:07:26 +0100 Subject: [PATCH] Internal: Stop using nyc --all for accurate reporting Use empty test files instead. See https://github.com/bcoe/nyc/issues/181 Closes #247 --- package.json | 2 +- src/Link/__tests__/index.js | 8 ++++++++ src/PageContainer/__tests__/index.js | 8 ++++++++ src/_utils/catch-links/__tests__/index.js | 8 ++++++++ src/bin/__tests__/index.js | 14 ++++++++++++++ src/builder/__tests__/index.js | 9 +++++++++ src/client/__tests__/DevTools.js | 8 ++++++++ src/client/__tests__/hot-md.js | 8 ++++++++ src/client/__tests__/index.js | 8 ++++++++ src/client/index.js | 9 ++++++--- src/static/__tests__/index.js | 8 ++++++++ 11 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 src/Link/__tests__/index.js create mode 100644 src/PageContainer/__tests__/index.js create mode 100644 src/_utils/catch-links/__tests__/index.js create mode 100644 src/bin/__tests__/index.js create mode 100644 src/builder/__tests__/index.js create mode 100644 src/client/__tests__/DevTools.js create mode 100644 src/client/__tests__/hot-md.js create mode 100644 src/client/__tests__/index.js create mode 100644 src/static/__tests__/index.js diff --git a/package.json b/package.json index 3f2e7b015..bd23f7712 100644 --- a/package.json +++ b/package.json @@ -171,7 +171,7 @@ "pretest": "npm run lint", "test": "npm run tests && npm run test-boilerplate", "posttest": "npm run docs", - "test-with-coverage": "nyc --all --require babel-core/register npm run tests && npm run test-boilerplate", + "test-with-coverage": "nyc npm run tests && npm run test-boilerplate", "posttest-with-coverage": "npm run docs ", "coverage": "nyc report --reporter=lcovonly && codecov", "release": "npmpub" diff --git a/src/Link/__tests__/index.js b/src/Link/__tests__/index.js new file mode 100644 index 000000000..4cbaaee0a --- /dev/null +++ b/src/Link/__tests__/index.js @@ -0,0 +1,8 @@ +import test from "ava" + +// files added to report accurate coverage +import "../index.js" + +test("todo", () => { + console.log("TODO: test src/Link/*") +}) diff --git a/src/PageContainer/__tests__/index.js b/src/PageContainer/__tests__/index.js new file mode 100644 index 000000000..8fec674e1 --- /dev/null +++ b/src/PageContainer/__tests__/index.js @@ -0,0 +1,8 @@ +import test from "ava" + +// files added to report accurate coverage +import "../index.js" + +test("todo", () => { + console.log("TODO: test src/PageContainer/index*") +}) diff --git a/src/_utils/catch-links/__tests__/index.js b/src/_utils/catch-links/__tests__/index.js new file mode 100644 index 000000000..d4a6c46a2 --- /dev/null +++ b/src/_utils/catch-links/__tests__/index.js @@ -0,0 +1,8 @@ +import test from "ava" + +// files added to report accurate coverage +import "../index.js" + +test("todo", () => { + console.log("TODO: test src/utils/catch-links/*") +}) diff --git a/src/bin/__tests__/index.js b/src/bin/__tests__/index.js new file mode 100644 index 000000000..2489ce9f3 --- /dev/null +++ b/src/bin/__tests__/index.js @@ -0,0 +1,14 @@ +import test from "ava" + +// files added to report accurate coverage +import "../data/questions.js" +import "../data/template.js" +import "../utils/inquirer.js" +// we need to explode those files into function and just call functions +// in the bins +// import "./index.js" +// import "./statinamic-setup.js" + +test("todo", () => { + console.log("TODO: test src/bin/*") +}) diff --git a/src/builder/__tests__/index.js b/src/builder/__tests__/index.js new file mode 100644 index 000000000..1258f2f4c --- /dev/null +++ b/src/builder/__tests__/index.js @@ -0,0 +1,9 @@ +import test from "ava" + +// files added to report accurate coverage +import "../index.js" +import "../webpack.js" + +test("todo", () => { + console.log("TODO: test src/builder/*") +}) diff --git a/src/client/__tests__/DevTools.js b/src/client/__tests__/DevTools.js new file mode 100644 index 000000000..a094559dd --- /dev/null +++ b/src/client/__tests__/DevTools.js @@ -0,0 +1,8 @@ +import test from "ava" + +// files added to report accurate coverage +import "../DevTools.js" + +test("todo", () => { + console.log("TODO: test src/client/DevTools*") +}) diff --git a/src/client/__tests__/hot-md.js b/src/client/__tests__/hot-md.js new file mode 100644 index 000000000..ccf098ad4 --- /dev/null +++ b/src/client/__tests__/hot-md.js @@ -0,0 +1,8 @@ +import test from "ava" + +// files added to report accurate coverage +import "../hot-md.js" + +test("todo", () => { + console.log("TODO: test src/client/hot-md") +}) diff --git a/src/client/__tests__/index.js b/src/client/__tests__/index.js new file mode 100644 index 000000000..2ff7b849b --- /dev/null +++ b/src/client/__tests__/index.js @@ -0,0 +1,8 @@ +import test from "ava" + +// files added to report accurate coverage +import "../index.js" + +test("todo", () => { + console.log("TODO: test src/client/index") +}) diff --git a/src/client/index.js b/src/client/index.js index bcda0c152..4ce66d5df 100644 --- a/src/client/index.js +++ b/src/client/index.js @@ -7,9 +7,12 @@ import { Provider as ReduxContextProvider } from "react-redux" import StatinamicContextProvider from "../ContextProvider" -export const browserHistory = useRouterHistory(createBrowserHistory)({ - basename: process.env.STATINAMIC_PATHNAME, -}) +export const browserHistory = + typeof window !== "undefined" // just for node testing + ? useRouterHistory(createBrowserHistory)({ + basename: process.env.STATINAMIC_PATHNAME, + }) + : null export default function statinamic({ layouts, diff --git a/src/static/__tests__/index.js b/src/static/__tests__/index.js new file mode 100644 index 000000000..3141fc7e9 --- /dev/null +++ b/src/static/__tests__/index.js @@ -0,0 +1,8 @@ +import test from "ava" + +// files added to report accurate coverage +import "../index.js" + +test("todo", () => { + console.log("TODO: test src/static/index*") +})