From 9ce7d1ca88b9b6666b7d163a782fbbfec85f9392 Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Mon, 6 Apr 2020 11:26:32 -0700 Subject: [PATCH 1/3] update template to make tests next to source files --- config/karma.base.js | 5 ++++- packages/installations/karma.conf.js | 1 - packages/messaging/karma.conf.js | 9 +++------ packages/template/karma.conf.js | 11 ++++++----- packages/template/package.json | 2 +- packages/template/{test => src}/index.test.ts | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) rename packages/template/{test => src}/index.test.ts (96%) diff --git a/config/karma.base.js b/config/karma.base.js index 9ba857dac90..dbaddccd4f7 100644 --- a/config/karma.base.js +++ b/config/karma.base.js @@ -57,7 +57,10 @@ const config = { // preprocess matching files before serving them to the browser // available preprocessors: // https://npmjs.org/browse/keyword/karma-preprocessor - preprocessors: { 'test/**/*.ts': ['webpack', 'sourcemap'] }, + preprocessors: { + 'test/**/*.ts': ['webpack', 'sourcemap'], + 'src/**/*.test.ts': ['webpack', 'sourcemap'] + }, mime: { 'text/x-typescript': ['ts', 'tsx'] }, diff --git a/packages/installations/karma.conf.js b/packages/installations/karma.conf.js index 6738e20eb99..432103b5260 100644 --- a/packages/installations/karma.conf.js +++ b/packages/installations/karma.conf.js @@ -23,7 +23,6 @@ module.exports = function(config) { config.set({ ...karmaBase, files, - preprocessors: { '**/*.ts': ['webpack', 'sourcemap'] }, frameworks: ['mocha'] }); }; diff --git a/packages/messaging/karma.conf.js b/packages/messaging/karma.conf.js index 329c40cc385..fa16f99db9d 100644 --- a/packages/messaging/karma.conf.js +++ b/packages/messaging/karma.conf.js @@ -15,21 +15,18 @@ * limitations under the License. */ -const karma = require('karma'); -const path = require('path'); const karmaBase = require('../../config/karma.base'); -const FILES = [`src/**/*.test.ts`]; +const files = [`src/**/*.test.ts`]; module.exports = function(config) { const karmaConfig = { ...karmaBase, - files: FILES, - preprocessors: { 'src/**/*.test.ts': ['webpack', 'sourcemap'] }, + files, frameworks: ['mocha'] }; config.set(karmaConfig); }; -module.exports.files = FILES; +module.exports.files = files; diff --git a/packages/template/karma.conf.js b/packages/template/karma.conf.js index f17ac2ebb9f..bdc535bcc03 100644 --- a/packages/template/karma.conf.js +++ b/packages/template/karma.conf.js @@ -17,16 +17,17 @@ const karmaBase = require('../../config/karma.base'); -const files = [`test/**/*`]; +const files = [`src/**/*.test.ts`]; -module.exports = function(config) { - const karmaConfig = Object.assign({}, karmaBase, { +module.exports = function (config) { + const karmaConfig = { + ...karmaBase, // files to load into karma - files: files, + files, // frameworks to use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter frameworks: ['mocha'] - }); + }; config.set(karmaConfig); }; diff --git a/packages/template/package.json b/packages/template/package.json index f35376dbf76..988618ae2e1 100644 --- a/packages/template/package.json +++ b/packages/template/package.json @@ -19,7 +19,7 @@ "dev": "rollup -c -w", "test": "yarn type-check && run-p lint test:browser test:node", "test:browser": "karma start --single-run", - "test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha test/**/*.test.* --opts ../../config/mocha.node.opts", + "test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.* --opts ../../config/mocha.node.opts", "type-check": "tsc -p . --noEmit", "prepare": "yarn build" }, diff --git a/packages/template/test/index.test.ts b/packages/template/src/index.test.ts similarity index 96% rename from packages/template/test/index.test.ts rename to packages/template/src/index.test.ts index b7cf66cb2ab..7528b5eb92e 100644 --- a/packages/template/test/index.test.ts +++ b/packages/template/src/index.test.ts @@ -16,7 +16,7 @@ */ import { expect } from 'chai'; -import { testFxn } from '../src'; +import { testFxn } from './index'; describe('Simple test', () => { it('Should skip this test'); From 5c4eebf553622f296455bd2fd920d768f46775a7 Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Mon, 6 Apr 2020 12:39:02 -0700 Subject: [PATCH 2/3] [AUTOMATED]: Prettier Code Styling --- config/karma.base.js | 2 +- packages/template/karma.conf.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/karma.base.js b/config/karma.base.js index dbaddccd4f7..4ff2da5062f 100644 --- a/config/karma.base.js +++ b/config/karma.base.js @@ -57,7 +57,7 @@ const config = { // preprocess matching files before serving them to the browser // available preprocessors: // https://npmjs.org/browse/keyword/karma-preprocessor - preprocessors: { + preprocessors: { 'test/**/*.ts': ['webpack', 'sourcemap'], 'src/**/*.test.ts': ['webpack', 'sourcemap'] }, diff --git a/packages/template/karma.conf.js b/packages/template/karma.conf.js index bdc535bcc03..c3347cb60c6 100644 --- a/packages/template/karma.conf.js +++ b/packages/template/karma.conf.js @@ -19,7 +19,7 @@ const karmaBase = require('../../config/karma.base'); const files = [`src/**/*.test.ts`]; -module.exports = function (config) { +module.exports = function(config) { const karmaConfig = { ...karmaBase, // files to load into karma From 337647739d08d53c9e2fa4672e248701c256d243 Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Mon, 6 Apr 2020 12:39:03 -0700 Subject: [PATCH 3/3] [AUTOMATED]: License Headers --- config/karma.base.js | 2 +- packages/installations/karma.conf.js | 2 +- packages/messaging/karma.conf.js | 2 +- packages/template/karma.conf.js | 2 +- packages/template/src/index.test.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/karma.base.js b/config/karma.base.js index 4ff2da5062f..5f9601ba31e 100644 --- a/config/karma.base.js +++ b/config/karma.base.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. + * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/packages/installations/karma.conf.js b/packages/installations/karma.conf.js index 432103b5260..d5f3eb24d49 100644 --- a/packages/installations/karma.conf.js +++ b/packages/installations/karma.conf.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2019 Google Inc. + * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/packages/messaging/karma.conf.js b/packages/messaging/karma.conf.js index fa16f99db9d..745d0b4bd99 100644 --- a/packages/messaging/karma.conf.js +++ b/packages/messaging/karma.conf.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. + * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/packages/template/karma.conf.js b/packages/template/karma.conf.js index c3347cb60c6..5d038e0ec61 100644 --- a/packages/template/karma.conf.js +++ b/packages/template/karma.conf.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2019 Google Inc. + * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/packages/template/src/index.test.ts b/packages/template/src/index.test.ts index 7528b5eb92e..52172a1749e 100644 --- a/packages/template/src/index.test.ts +++ b/packages/template/src/index.test.ts @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. + * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.