diff --git a/README.md b/README.md index c453174..7a2b9a3 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ module.exports = [ **Using programatically** ``` -const SmokeTests = require('@financial-times/n-test').SmokeTests; +const SmokeTest = require('@financial-times/n-test').SmokeTest; const smoke = new SmokeTests({ headers: { globalHeader: true }, host: 'local.ft.com:3002' }); //Add custom checks like so: @@ -97,11 +97,11 @@ smoke.addCheck('custom', async (testPage) => { } }); -nTest.smoke.runf +smoke.run() .then((results) => { //all passed }) .catch((results) => { //some failed }); -nTest.smoke.run({}, ['basic']); +smoke.run(['basic']); ``` #### Open diff --git a/index.js b/index.js index 7a0c120..2b4c319 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ 'use strict'; module.exports = { - smoke: require('./lib/smoke') + SmokeTest: require('./lib/smoke') }; diff --git a/lib/smoke/checks.js b/lib/smoke/checks.js index 3117bd5..3849990 100644 --- a/lib/smoke/checks.js +++ b/lib/smoke/checks.js @@ -3,6 +3,7 @@ const verifyCacheHeaders = require('./verify-cache-headers'); module.exports = { status: (testPage) => { if (testPage.check.status === 204) { + //eslint-disable-next-line no-console console.info('204 status checks are not supported yet!'); return { expected: 204, actual: '¯\_(ツ)_/¯ ', result: true }; return true; @@ -18,6 +19,7 @@ module.exports = { }, pageErrors: (testPage) => { + //eslint-disable-next-line no-console console.debug('Errors on page: ' + testPage.pageErrors); return { expected: `no more than ${testPage.check.pageErrors} console errors`, diff --git a/tasks/smoke.js b/tasks/smoke.js index 178ec5a..370e5e2 100644 --- a/tasks/smoke.js +++ b/tasks/smoke.js @@ -2,8 +2,6 @@ const SmokeTests = require('../lib/smoke'); module.exports = (program) => { - - program .command('smoke [sets...]') .option('-a, --auth', 'Authenticate with FT_NEXT_BACKEND_KEY') diff --git a/test/tasks/smoke.js b/test/tasks/smoke.js index 6678bc7..bdc47b3 100644 --- a/test/tasks/smoke.js +++ b/test/tasks/smoke.js @@ -1,7 +1,7 @@ /*globals beforeAll, expect */ const server = require('../server/app'); -const SmokeTests = require('../../lib/smoke'); +const SmokeTest = require('../../lib/smoke'); describe('Smoke Tests of the Smoke', () => { @@ -12,7 +12,7 @@ describe('Smoke Tests of the Smoke', () => { describe('status checks', () => { test('tests should pass if all the urls return the correct status', (done) => { - const smoke = new SmokeTests({ + const smoke = new SmokeTest({ host: 'http://localhost:3004', config: 'test/fixtures/smoke-status-pass.js' }); @@ -26,7 +26,7 @@ describe('Smoke Tests of the Smoke', () => { test('tests should fail if some urls return the incorrect status code', (done) => { - const smoke = new SmokeTests({ + const smoke = new SmokeTest({ host: 'http://localhost:3004', config: 'test/fixtures/smoke-status-fail.js' }); @@ -42,7 +42,7 @@ describe('Smoke Tests of the Smoke', () => { describe('CSS coverage', () => { test('tests should pass if CSS is well covered',(done) => { - const smoke = new SmokeTests({ + const smoke = new SmokeTest({ host: 'http://localhost:3004', config: 'test/fixtures/smoke-coverage-pass.js' }); @@ -57,7 +57,7 @@ describe('Smoke Tests of the Smoke', () => { test('tests should fail if CSS coverage is below threshold', (done) => { - const smoke = new SmokeTests({ + const smoke = new SmokeTest({ host: 'http://localhost:3004', config: 'test/fixtures/smoke-coverage-fail.js' }); @@ -73,7 +73,7 @@ describe('Smoke Tests of the Smoke', () => { describe('Adding custom checks', () => { test('should allow adding custom assertions',(done) => { - const smoke = new SmokeTests({ + const smoke = new SmokeTest({ host: 'http://localhost:3004', config: 'test/fixtures/smoke-custom-check.js' }); @@ -85,7 +85,7 @@ describe('Smoke Tests of the Smoke', () => { expected: `no more than ${testPage.check.custom} DOM nodes`, actual: `${metrics.Nodes} nodes`, result: testPage.check.custom >= metrics.Nodes - } + }; }); return smoke.run() .then((results) => {