Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbranch committed Jun 8, 2019
1 parent bb2722b commit 7a1215f
Show file tree
Hide file tree
Showing 14 changed files with 114 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/execution-tests/3.0.1_projectReferencesDisabled/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* eslint-disable no-var, strict */
'use strict';
var webpackConfig = require('./webpack.config.js');
var makeKarmaConfig = require('../../karmaConfig');

module.exports = function(config) {
config.set(
makeKarmaConfig({
config,
webpackConfig,
files: [
// This ensures we have the es6 shims in place from babel and then loads all the tests
'main.js'
]
})
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!*.js.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export declare const lib: {
one: number;
two: number;
three: number;
};
10 changes: 10 additions & 0 deletions test/execution-tests/3.0.1_projectReferencesDisabled/lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const lib = {
one: 1,
two: 2,
three: 3
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"composite": true,
"sourceMap": true
},
"files": [
"./index.ts"
]
}
2 changes: 2 additions & 0 deletions test/execution-tests/3.0.1_projectReferencesDisabled/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const testsContext = require.context('./', true, /\.tests\.ts(x?)$/);
testsContext.keys().forEach(testsContext);
10 changes: 10 additions & 0 deletions test/execution-tests/3.0.1_projectReferencesDisabled/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "basic",
"license": "MIT",
"version": "1.0.0",
"main": "index.js",
"devDependencies": {
"@types/jasmine": "^2.5.35",
"jasmine-core": "^2.3.4"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { lib } from '../lib';

export function whatNumbersDoYouHave() {
return [lib.one, lib.two, lib.three];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { whatNumbersDoYouHave } from "../src/app";

describe("app", () => {
it("code compiled using projectReferences can be consumed", () => {
expect(whatNumbersDoYouHave()).toEqual([1, 2, 3]);
});
});
11 changes: 11 additions & 0 deletions test/execution-tests/3.0.1_projectReferencesDisabled/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"files": [
"./src/app.ts"
],
"references": [
{ "path": "./lib" }
],
"compilerOptions": {
"noEmitOnError": true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
mode: 'development',
entry: './src/app.ts',
output: {
filename: 'bundle.js'
},
resolve: {
extensions: ['.ts', '.js']
},
module: {
rules: [
{ test: /\.ts$/, loader: 'ts-loader', options: { projectReferences: false } }
]
}
}

// for test harness purposes only, you would not need this in a normal project
module.exports.resolveLoader = { alias: { 'ts-loader': require('path').join(__dirname, "../../../index.js") } }
13 changes: 13 additions & 0 deletions test/execution-tests/3.0.1_projectReferencesDisabled/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


"@types/jasmine@^2.5.35":
version "2.8.5"
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.8.5.tgz#96e58872583fa80c7ea0dd29024b180d5e133678"
integrity sha512-mkrHFZTgOXkZhau36K628iKFkjbp11t/bHCkY4Mefu4R6McMg2FD9P3naBv/0Ygyn4sz8baColJp2gdmSekgiw==

jasmine-core@^2.3.4:
version "2.9.1"
resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.9.1.tgz#b6bbc1d8e65250d56f5888461705ebeeeb88f22f"
integrity sha1-trvB2OZSUNVvWIhGFwXr7uuI8i8=

0 comments on commit 7a1215f

Please sign in to comment.