Skip to content

Commit 7f69b70

Browse files
authored
Update @firebase/template to move tests next to source files (#2875)
* update template to make tests next to source files * [AUTOMATED]: Prettier Code Styling * [AUTOMATED]: License Headers
1 parent 0cad04b commit 7f69b70

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

config/karma.base.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -57,7 +57,10 @@ const config = {
5757
// preprocess matching files before serving them to the browser
5858
// available preprocessors:
5959
// https://npmjs.org/browse/keyword/karma-preprocessor
60-
preprocessors: { 'test/**/*.ts': ['webpack', 'sourcemap'] },
60+
preprocessors: {
61+
'test/**/*.ts': ['webpack', 'sourcemap'],
62+
'src/**/*.test.ts': ['webpack', 'sourcemap']
63+
},
6164

6265
mime: { 'text/x-typescript': ['ts', 'tsx'] },
6366

packages/installations/karma.conf.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2019 Google Inc.
3+
* Copyright 2019 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -23,7 +23,6 @@ module.exports = function(config) {
2323
config.set({
2424
...karmaBase,
2525
files,
26-
preprocessors: { '**/*.ts': ['webpack', 'sourcemap'] },
2726
frameworks: ['mocha']
2827
});
2928
};

packages/messaging/karma.conf.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -15,21 +15,18 @@
1515
* limitations under the License.
1616
*/
1717

18-
const karma = require('karma');
19-
const path = require('path');
2018
const karmaBase = require('../../config/karma.base');
2119

22-
const FILES = [`src/**/*.test.ts`];
20+
const files = [`src/**/*.test.ts`];
2321

2422
module.exports = function(config) {
2523
const karmaConfig = {
2624
...karmaBase,
27-
files: FILES,
28-
preprocessors: { 'src/**/*.test.ts': ['webpack', 'sourcemap'] },
25+
files,
2926
frameworks: ['mocha']
3027
};
3128

3229
config.set(karmaConfig);
3330
};
3431

35-
module.exports.files = FILES;
32+
module.exports.files = files;

packages/template/karma.conf.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2019 Google Inc.
3+
* Copyright 2019 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -17,16 +17,17 @@
1717

1818
const karmaBase = require('../../config/karma.base');
1919

20-
const files = [`test/**/*`];
20+
const files = [`src/**/*.test.ts`];
2121

2222
module.exports = function(config) {
23-
const karmaConfig = Object.assign({}, karmaBase, {
23+
const karmaConfig = {
24+
...karmaBase,
2425
// files to load into karma
25-
files: files,
26+
files,
2627
// frameworks to use
2728
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
2829
frameworks: ['mocha']
29-
});
30+
};
3031

3132
config.set(karmaConfig);
3233
};

packages/template/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"dev": "rollup -c -w",
2020
"test": "yarn type-check && run-p lint test:browser test:node",
2121
"test:browser": "karma start --single-run",
22-
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha test/**/*.test.* --opts ../../config/mocha.node.opts",
22+
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.* --opts ../../config/mocha.node.opts",
2323
"type-check": "tsc -p . --noEmit",
2424
"prepare": "yarn build"
2525
},

packages/template/test/index.test.ts renamed to packages/template/src/index.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
1616
*/
1717

1818
import { expect } from 'chai';
19-
import { testFxn } from '../src';
19+
import { testFxn } from './index';
2020

2121
describe('Simple test', () => {
2222
it('Should skip this test');

0 commit comments

Comments
 (0)