Skip to content

Commit

Permalink
Using TS paths now.
Browse files Browse the repository at this point in the history
  • Loading branch information
julienblin committed Jun 5, 2018
1 parent d48f5bf commit 8685de0
Show file tree
Hide file tree
Showing 18 changed files with 92 additions and 30 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"memoized",
"opiniated",
"prebuild"
]
],
"typescript.tsdk": "node_modules\\typescript\\lib"
}
49 changes: 49 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
"source-map-support": "^0.5.6",
"ts-loader": "^4.3.0",
"ts-node": "^6.0.3",
"tsconfig-paths": "^3.3.2",
"tsconfig-paths-webpack-plugin": "^3.1.4",
"tslint": "^5.10.0",
"tslint-no-unused-expression-chai": "^0.1.3",
"typescript": "^2.8.3",
Expand Down
1 change: 1 addition & 0 deletions test/mocha.opts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-r ts-node/register
-r source-map-support/register
-r tsconfig-paths/register
test/**/*-test.ts
6 changes: 3 additions & 3 deletions test/unit/config-aws-test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ConfigService } from "@src/config";
import { SSMParameterStoreClient, SSMParameterStoreConfigService } from "@src/config-aws";
import { HealthCheckStatus } from "@src/health-checks";
import { AWSError, Response, SSM } from "aws-sdk";
import { PromiseResult } from "aws-sdk/lib/request";
import { expect } from "chai";
import { describe, it } from "mocha";
import { ConfigService } from "../../src/config";
import { SSMParameterStoreClient, SSMParameterStoreConfigService } from "../../src/config-aws";
import { HealthCheckStatus } from "../../src/health-checks";

const path = "/opiniated-lambda/tests";

Expand Down
2 changes: 1 addition & 1 deletion test/unit/config-test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ConfigService, JSONFileConfigService, ProcessEnvConfigService, StaticConfigService } from "@src/config";
import { expect } from "chai";
import { describe, it } from "mocha";
import { ConfigService, JSONFileConfigService, ProcessEnvConfigService, StaticConfigService } from "../../src/config";

describe("StaticConfigService", () => {

Expand Down
2 changes: 1 addition & 1 deletion test/unit/container-test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createContainerFactory } from "@src/container";
import { expect } from "chai";
import { describe, it } from "mocha";
import { createContainerFactory } from "../../src/container";

interface IA {}

Expand Down
2 changes: 1 addition & 1 deletion test/unit/errors-test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { dependencyErrorProxy, internalServerError } from "@src/errors";
import { expect } from "chai";
import { describe, it } from "mocha";
import { dependencyErrorProxy, internalServerError } from "../../src/errors";

describe("dependencyErrorProxy", () => {

Expand Down
6 changes: 3 additions & 3 deletions test/unit/health-checks-test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
checkHealth, HealthChecker, HealthCheckResult,
HealthCheckStatus, ICheckHealth } from "@src/health-checks";
import { expect } from "chai";
import * as HttpStatusCodes from "http-status-codes";
import { describe, it } from "mocha";
import {
checkHealth, HealthChecker, HealthCheckResult,
HealthCheckStatus, ICheckHealth } from "../../src/health-checks";

describe("HealthChecker", () => {

Expand Down
2 changes: 1 addition & 1 deletion test/unit/key-value-repository-test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { InMemoryKeyValueRepository } from "@src/key-value-repository";
import { expect } from "chai";
import { describe, it } from "mocha";
import { InMemoryKeyValueRepository } from "../../src/key-value-repository";

describe("InMemoryKeyValueRepository", () => {

Expand Down
10 changes: 5 additions & 5 deletions test/unit/lambda-authorizer-test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { createContainerFactory } from "@src/container";
import {
containerLambdaAuthorizerBearer, lambdaAuthorizerBearer,
LambdaAuthorizerBearerError } from "@src/lambda-authorizer";
import { randomStr } from "@src/utils";
import { CustomAuthorizerResult } from "aws-lambda";
import { expect } from "chai";
import { describe, it } from "mocha";
import { createContainerFactory } from "../../src/container";
import {
containerLambdaAuthorizerBearer, lambdaAuthorizerBearer,
LambdaAuthorizerBearerError } from "../../src/lambda-authorizer";
import { randomStr } from "../../src/utils";
import { createLambdaContext } from "./lambda-helper-test";

describe("lambdaAuthorizerBearer", () => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/lambda-helper-test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { randomStr } from "@src/utils";
import { Context } from "aws-lambda";
import { randomStr } from "../../src/utils";

export const createLambdaContext = (): Context => ({
awsRequestId: randomStr(),
Expand Down
8 changes: 4 additions & 4 deletions test/unit/lambda-proxy-test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { createContainerFactory } from "@src/container";
import { containerLambdaProxy, lambdaProxy, LambdaProxyError } from "@src/lambda-proxy";
import { APIGatewayProxyResultProvider } from "@src/results";
import { randomStr } from "@src/utils";
import { APIGatewayProxyEvent, APIGatewayProxyResult, ProxyCallback } from "aws-lambda";
import { expect } from "chai";
import * as HttpStatusCodes from "http-status-codes";
import { describe, it } from "mocha";
import { createContainerFactory } from "../../src/container";
import { containerLambdaProxy, lambdaProxy, LambdaProxyError } from "../../src/lambda-proxy";
import { APIGatewayProxyResultProvider } from "../../src/results";
import { randomStr } from "../../src/utils";
import { createLambdaContext } from "./lambda-helper-test";

describe("lambdaProxy", () => {
Expand Down
6 changes: 3 additions & 3 deletions test/unit/lambda-test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createContainerFactory } from "@src/container";
import { containerLambda, lambda, LambdaError } from "@src/lambda";
import { randomStr } from "@src/utils";
import { expect } from "chai";
import { describe, it } from "mocha";
import { createContainerFactory } from "../../src/container";
import { containerLambda, lambda, LambdaError } from "../../src/lambda";
import { randomStr } from "../../src/utils";
import { createLambdaContext } from "./lambda-helper-test";

describe("lambda", () => {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/results-test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { defaultBodySerializer } from "@src/lambda-proxy";
import * as results from "@src/results";
import { expect } from "chai";
import * as HttpStatusCodes from "http-status-codes";
import { describe, it } from "mocha";
import { defaultBodySerializer } from "../../src/lambda-proxy";
import * as results from "../../src/results";

describe("results", () => {

Expand Down
6 changes: 3 additions & 3 deletions test/unit/utils-test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect } from "chai";
import { describe, it } from "mocha";
import {
convertHrtimeToMs, createConfidentialityReplacer,
DEFAULT_CONFIDENTIALITY_REPLACE_BY, memoize, randomStr, safeJSONStringify } from "../../src/utils";
DEFAULT_CONFIDENTIALITY_REPLACE_BY, memoize, randomStr, safeJSONStringify } from "@src/utils";
import { expect } from "chai";
import { describe, it } from "mocha";

describe("convertHrtimeToMs", () => {

Expand Down
7 changes: 6 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
"moduleResolution": "node",
"sourceMap": true,
"declaration": true,
"noImplicitAny": false
"noImplicitAny": false,
"rootDir": "./",
"baseUrl": ".",
"paths": {
"@src/*": ["./src/*"]
}
},
"exclude": [
"./test"
Expand Down
4 changes: 4 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');

const distFolder = path.join(__dirname, 'dist');

Expand All @@ -14,6 +15,9 @@ module.exports = {
'.js',
'.json',
'.ts'
],
plugins: [
new TsconfigPathsPlugin()
]
},
output: {
Expand Down

0 comments on commit 8685de0

Please sign in to comment.