Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: move test files to src/__tests__ in packages #2330

Merged
merged 1 commit into from
Feb 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .nycrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
"examples/*/dist"
],
"exclude": [
"packages/*/dist/test/",
"packages/*/dist/__tests__/",
"packages/cli/test/",
"examples/*/dist/test/",
"examples/*/dist/__tests__/",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should have made this change in the previous pull request. I think the drop in code coverage is caused by the fact that before, we were including test files in example projects in lines-to-be-covered. Test files usually have 100% coverage, which is skewing the coverage value upwards.

**coverage/coveralls ** — Coverage decreased (-0.8%) to 90.429%

"**/.sandbox/"
],
"extension": [
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"args": [
"--opts",
"${workspaceRoot}/test/mocha.opts",
"packages/*/dist/test/**/*.js",
"packages/*/dist/__tests__/**/*.js",
"-t",
"0"
]
Expand Down
2 changes: 1 addition & 1 deletion benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"build": "lb-tsc es2017 --outDir dist",
"clean": "lb-clean dist",
"pretest": "npm run clean && npm run build",
"test": "lb-mocha \"dist/test\"",
"test": "lb-mocha \"dist/__tests__\"",
"prestart": "npm run build",
"benchmark:routing": "node ./dist/src/rest-routing/routing-table",
"start": "node ."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import {expect} from '@loopback/testlab';
import * as request from 'request-promise-native';
import {Benchmark} from '..';
import {Autocannon, EndpointStats} from '../src/autocannon';
import {Autocannon, EndpointStats} from '../autocannon';

const debug = require('debug')('test');

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"test:ci": "node packages/build/bin/run-nyc npm run mocha --scripts-prepend-node-path",
"verify:docs": "npm run build:site -- --verify",
"build:site": "./bin/build-docs-site.sh",
"mocha": "node packages/build/bin/run-mocha \"packages/*/dist/test/**/*.js\" \"packages/*/dist/__tests__/**/*.js\" \"examples/*/dist/__tests__/**/*.js\" \"packages/cli/test/**/*.js\" \"packages/build/test/*/*.js\"",
"mocha": "node packages/build/bin/run-mocha \"packages/*/dist/__tests__/**/*.js\" \"examples/*/dist/__tests__/**/*.js\" \"packages/cli/test/**/*.js\" \"packages/build/test/*/*.js\"",
"posttest": "npm run lint"
},
"config": {
Expand Down
14 changes: 7 additions & 7 deletions packages/authentication/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
"node": ">=8.9"
},
"scripts": {
"acceptance": "lb-mocha \"dist/test/acceptance/**/*.js\"",
"acceptance": "lb-mocha \"dist/__tests__/acceptance/**/*.js\"",
"build:apidocs": "lb-apidocs",
"build": "lb-tsc es2017 --outDir dist",
"clean": "lb-clean loopback-authentication*.tgz dist package api-docs",
"integration": "lb-mocha \"dist/test/integration/**/*.js\"",
"integration": "lb-mocha \"dist/__tests__/integration/**/*.js\"",
"pretest": "npm run build",
"test": "lb-mocha \"dist/test/unit/**/*.js\" \"dist/test/integration/**/*.js\" \"dist/test/acceptance/**/*.js\"",
"unit": "lb-mocha \"dist/test/unit/**/*.js\"",
"test": "lb-mocha \"dist/__tests__/unit/**/*.js\" \"dist/__tests__/integration/**/*.js\" \"dist/__tests__/acceptance/**/*.js\"",
"unit": "lb-mocha \"dist/__tests__/unit/**/*.js\"",
"verify": "npm pack && tar xf loopback-authentication*.tgz && tree package && npm run clean"
},
"author": "IBM",
Expand Down Expand Up @@ -46,9 +46,9 @@
"README.md",
"index.js",
"index.d.ts",
"dist/src",
"dist/index*",
"src"
"dist",
"src",
"!*/__tests__"
],
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {expect} from '@loopback/testlab';
import {CoreBindings} from '@loopback/core';
import {Context, Provider} from '@loopback/context';
import {AuthenticationMetadata, authenticate} from '../../..';
import {AuthMetadataProvider} from '../../../src/providers';
import {AuthMetadataProvider} from '../../../providers';

describe('AuthMetadataProvider', () => {
let provider: Provider<AuthenticationMetadata | undefined>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {Request} from '@loopback/rest';
import {AuthenticateFn, UserProfile, AuthenticationBindings} from '../../..';
import {MockStrategy} from '../fixtures/mock-strategy';
import {Strategy} from 'passport';
import {AuthenticateActionProvider} from '../../../src/providers';
import {AuthenticateActionProvider} from '../../../providers';

describe('AuthenticateActionProvider', () => {
describe('constructor()', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/authentication/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "@loopback/build/config/tsconfig.common.json",
"compilerOptions": {
"rootDir": "."
"rootDir": "src"
},
"include": ["index.ts", "src", "test"]
"include": ["src"]
}
15 changes: 7 additions & 8 deletions packages/boot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
"access": "public"
},
"scripts": {
"acceptance": "lb-mocha \"dist/test/acceptance/**/*.js\"",
"acceptance": "lb-mocha \"dist/__tests__/acceptance/**/*.js\"",
"build:apidocs": "lb-apidocs",
"build": "lb-tsc es2017 --outDir dist",
"clean": "lb-clean loopback-boot*.tgz dist package api-docs",
"pretest": "npm run build",
"integration": "lb-mocha \"dist/test/integration/**/*.js\"",
"test": "lb-mocha \"dist/test/unit/**/*.js\" \"dist/test/integration/**/*.js\" \"dist/test/acceptance/**/*.js\"",
"unit": "lb-mocha \"dist/test/unit/**/*.js\"",
"integration": "lb-mocha \"dist/__tests__/integration/**/*.js\"",
"test": "lb-mocha \"dist/__tests__/unit/**/*.js\" \"dist/__tests__/integration/**/*.js\" \"dist/__tests__/acceptance/**/*.js\"",
"unit": "lb-mocha \"dist/__tests__/unit/**/*.js\"",
"verify": "npm pack && tar xf loopback-boot*.tgz && tree package && npm run clean"
},
"author": "IBM",
Expand All @@ -43,11 +43,10 @@
"files": [
"README.md",
"index.js",
"index.js.map",
"index.d.ts",
"dist/src",
"dist/index*",
"src"
"dist",
"src",
"!*/__tests__"
],
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions packages/boot/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "@loopback/build/config/tsconfig.common.json",
"compilerOptions": {
"rootDir": "."
"rootDir": "src"
},
"include": ["index.ts", "src", "test"]
"include": ["src"]
}
2 changes: 1 addition & 1 deletion packages/build/bin/select-dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Then the provided command is executed with the modified arguments.

Example usage:

node ./bin/select-dist mocha dist/test
node ./bin/select-dist mocha dist/__tests__

========
*/
Expand Down
12 changes: 6 additions & 6 deletions packages/context/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"node": ">=8.9"
},
"scripts": {
"acceptance": "lb-mocha \"dist/test/acceptance/**/*.js\"",
"acceptance": "lb-mocha \"dist/__tests__/acceptance/**/*.js\"",
"build:apidocs": "lb-apidocs",
"build": "lb-tsc es2017 --outDir dist",
"clean": "lb-clean loopback-context*.tgz dist package api-docs",
"pretest": "npm run build",
"test": "lb-mocha \"dist/test/unit/**/*.js\" \"dist/test/acceptance/**/*.js\"",
"unit": "lb-mocha \"dist/test/unit/**/*.js\"",
"test": "lb-mocha \"dist/__tests__/unit/**/*.js\" \"dist/__tests__/acceptance/**/*.js\"",
"unit": "lb-mocha \"dist/__tests__/unit/**/*.js\"",
"verify": "npm pack && tar xf loopback-context*.tgz && tree package && npm run clean"
},
"author": "IBM",
Expand Down Expand Up @@ -46,9 +46,9 @@
"README.md",
"index.js",
"index.d.ts",
"dist/src",
"dist/index*",
"src"
"dist",
"src",
"!*/__tests__"
],
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
// License text available at https://opensource.org/licenses/MIT

import {expect} from '@loopback/testlab';
import {Context, bind, BindingScope, Provider} from '../..';
import {createBindingFromClass} from '../../src';
import {
bind,
BindingScope,
Context,
createBindingFromClass,
Provider,
} from '../..';

describe('@bind - customize classes with binding attributes', () => {
@bind({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
import {expect} from '@loopback/testlab';
import {
bind,
BindingFromClassOptions,
BindingScope,
BindingScopeAndTags,
Constructor,
Context,
createBindingFromClass,
Provider,
} from '../..';
import {BindingFromClassOptions} from '../../src';

describe('createBindingFromClass()', () => {
it('inspects classes', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/context/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "@loopback/build/config/tsconfig.common.json",
"compilerOptions": {
"rootDir": "."
"rootDir": "src"
},
"include": ["index.ts", "src", "test"]
"include": ["src"]
}
14 changes: 7 additions & 7 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
"node": ">=8.9"
},
"scripts": {
"acceptance": "lb-mocha \"dist/test/acceptance/**/*.js\"",
"acceptance": "lb-mocha \"dist/__tests__/acceptance/**/*.js\"",
"build:apidocs": "lb-apidocs",
"build": "lb-tsc es2017 --outDir dist",
"clean": "lb-clean loopback-core*.tgz dist package api-docs",
"pretest": "npm run build",
"integration": "lb-mocha \"dist/test/integration/**/*.js\"",
"test": "lb-mocha \"dist/test/unit/**/*.js\" \"dist/test/integration/**/*.js\" \"dist/test/acceptance/**/*.js\"",
"unit": "lb-mocha \"dist/test/unit/**/*.js\"",
"integration": "lb-mocha \"dist/__tests__/integration/**/*.js\"",
"test": "lb-mocha \"dist/__tests__/unit/**/*.js\" \"dist/__tests__/integration/**/*.js\" \"dist/__tests__/acceptance/**/*.js\"",
"unit": "lb-mocha \"dist/__tests__/unit/**/*.js\"",
"verify": "npm pack && tar xf loopback-core*.tgz && tree package && npm run clean"
},
"author": "IBM",
Expand All @@ -32,9 +32,9 @@
"README.md",
"index.js",
"index.d.ts",
"dist/src",
"dist/index*",
"src"
"dist",
"src",
"!*/__tests__"
],
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions packages/core/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "@loopback/build/config/tsconfig.common.json",
"compilerOptions": {
"rootDir": "."
"rootDir": "src"
},
"include": ["index.ts", "src", "test"]
"include": ["src"]
}
8 changes: 4 additions & 4 deletions packages/http-caching-proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build": "lb-tsc es2017 --outDir dist",
"clean": "lb-clean loopback-caching-proxy*.tgz dist package api-docs",
"pretest": "npm run build",
"test": "lb-mocha \"dist/test/integration/**/*.js\"",
"test": "lb-mocha \"dist/__tests__/integration/**/*.js\"",
"verify": "npm pack && tar xf loopback-caching-proxy*.tgz && tree package && npm run clean"
},
"author": "IBM",
Expand Down Expand Up @@ -46,9 +46,9 @@
"README.md",
"index.js",
"index.d.ts",
"dist/src",
"dist/index*",
"src"
"dist",
"src",
"!*/__tests__"
],
"publishConfig": {
"access": "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as path from 'path';
import * as makeRequest from 'request-promise-native';
import * as rimrafCb from 'rimraf';
import * as util from 'util';
import {HttpCachingProxy, ProxyOptions} from '../../src/http-caching-proxy';
import {HttpCachingProxy, ProxyOptions} from '../../http-caching-proxy';

const CACHE_DIR = path.join(__dirname, '.cache');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// License text available at https://opensource.org/licenses/MIT

import {expect} from '@loopback/testlab';
import {HttpCachingProxy} from '../../src/http-caching-proxy';
import {HttpCachingProxy} from '../../http-caching-proxy';

describe('HttpCachingProxy', () => {
describe('constructor', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/http-caching-proxy/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "@loopback/build/config/tsconfig.common.json",
"compilerOptions": {
"rootDir": "."
"rootDir": "src"
},
"include": ["index.ts", "src", "test"]
"include": ["src"]
}
8 changes: 4 additions & 4 deletions packages/http-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build": "lb-tsc es2017 --outDir dist",
"clean": "lb-clean loopback-http-server*.tgz dist package api-docs",
"pretest": "npm run build",
"test": "lb-mocha \"dist/test/**/*.js\"",
"test": "lb-mocha \"dist/__tests__/**/*.js\"",
"verify": "npm pack && tar xf loopback-http-server*.tgz && tree package && npm run clean"
},
"author": "IBM",
Expand All @@ -33,9 +33,9 @@
"README.md",
"index.js",
"index.d.ts",
"dist/src",
"dist/index*",
"src"
"dist",
"src",
"!*/__tests__"
],
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions packages/http-server/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "@loopback/build/config/tsconfig.common.json",
"compilerOptions": {
"rootDir": "."
"rootDir": "src"
},
"include": ["index.ts", "src", "test"]
"include": ["src"]
}
12 changes: 6 additions & 6 deletions packages/metadata/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"node": ">=8.9"
},
"scripts": {
"acceptance": "lb-mocha \"dist/test/acceptance/**/*.js\"",
"acceptance": "lb-mocha \"dist/__tests__/acceptance/**/*.js\"",
"build:apidocs": "lb-apidocs",
"build": "lb-tsc es2017 --outDir dist",
"clean": "lb-clean loopback-metadata*.tgz dist package api-docs",
"pretest": "npm run build",
"test": "lb-mocha \"dist/test/unit/**/*.js\" \"dist/test/acceptance/**/*.js\"",
"unit": "lb-mocha \"dist/test/unit/**/*.js\"",
"test": "lb-mocha \"dist/__tests__/unit/**/*.js\" \"dist/__tests__/acceptance/**/*.js\"",
"unit": "lb-mocha \"dist/__tests__/unit/**/*.js\"",
"verify": "npm pack && tar xf loopback-metadata*.tgz && tree package && npm run clean"
},
"author": "IBM",
Expand Down Expand Up @@ -40,9 +40,9 @@
"README.md",
"index.js",
"index.d.ts",
"dist/src",
"dist/index*",
"src"
"dist",
"src",
"!*/__tests__"
],
"publishConfig": {
"access": "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// License text available at https://opensource.org/licenses/MIT

import {expect} from '@loopback/testlab';
import {NamespacedReflect, Reflector} from '../../src/reflect';
import {NamespacedReflect, Reflector} from '../../reflect';
import 'reflect-metadata';

function givenReflectContextWithNameSpace(): NamespacedReflect {
Expand Down
Loading