Skip to content

Commit

Permalink
feat: Added initial test support
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrydn committed Oct 24, 2023
1 parent 02a20f0 commit 2e53aad
Show file tree
Hide file tree
Showing 19 changed files with 13,173 additions and 1,035 deletions.
1 change: 1 addition & 0 deletions vue3-express-spa-ts/deploy/aws-lambda/cdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import * as cdk from 'aws-cdk-lib';
'aws-lambda/cdk.out/**',
'aws-lambda/cdk.out/.cache/*',
'!aws-lambda/*.js*',
'aws-lambda/*.test.js',
'!server/**',
],
}),
Expand Down
18 changes: 16 additions & 2 deletions vue3-express-spa-ts/deploy/server/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,22 @@ const etag = require('etag');
const path = require('path');

const frontendClientPath = path.resolve(__dirname, './dist/frontend');
const indexPage = fs.readFileSync(path.join(frontendClientPath, 'index.html'), 'utf-8');
const indexEtag = etag(indexPage, { weak: true });

let indexPage;
try {
indexPage = fs.readFileSync(path.join(frontendClientPath, 'index.html'), 'utf-8');
} catch (err) {
err.message = `Error fetching frontend/client/index.html: ${err.message}`;
throw err;
}

let indexEtag;
try {
indexEtag = etag(indexPage, { weak: true });
} catch (err) {
err.message = `Error calculating frontend/client/index.html: ${err.message}`;
throw err;
}

module.exports = {
frontendClientPath,
Expand Down
2 changes: 1 addition & 1 deletion vue3-express-spa-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "eslint . --ext .js,.ts",
"postinstall": "./install.sh",
"start": "npm --prefix ./deploy/server start",
"test:src": "NODE_ENV=testing mocha './src/*/{,!(node_modules)/**}/*.test.{,+(js|ts)}'",
"test:src": "NODE_ENV=testing mocha './src/backend/{,!(node_modules)/**}/*.test.{,+(js|ts)}'",
"test:deploy": "NODE_ENV=testing mocha './deploy/*/{,!(node_modules)/**}/*.test.{,+(js|ts)'}"
},
"repository": "https://github.com/someimportantcompany/starter-templates",
Expand Down
3 changes: 2 additions & 1 deletion vue3-express-spa-ts/src/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "0.0.0",
"private": true,
"scripts": {
"build": "esbuild api.ts --bundle --external:dtrace-provider --outdir=dist --platform=node"
"build": "esbuild api.ts --bundle --external:dtrace-provider --outdir=dist --platform=node",
"test": "NODE_ENV=testing mocha './{,!(node_modules)/**}/*.test.{,+(js|ts)}'"
},
"dependencies": {
"bunyan": "^1.8.15",
Expand Down
Loading

0 comments on commit 2e53aad

Please sign in to comment.