Skip to content

Commit 9a8bcd0

Browse files
Parking orbits the sfdx-plugin-lwc-test plugin (#50)
1 parent 5450da2 commit 9a8bcd0

33 files changed

+6330
-2015
lines changed

.circleci/config.yml

Lines changed: 100 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,103 @@
1-
---
2-
version: 2
3-
jobs:
4-
build_and_test:
5-
working_directory: ~/sfdx-plugin-lwc-test
6-
7-
docker:
8-
- image: circleci/node:lts
9-
10-
steps:
11-
- checkout
12-
13-
- restore_cache:
14-
keys:
15-
- yarn-v3-{{ checksum "yarn.lock" }}
16-
17-
- run:
18-
name: Install dependencies
19-
command: yarn
20-
21-
- run:
22-
name: Build
23-
command: yarn build
24-
25-
- run:
26-
name: Check License Headers
27-
command: yarn check-license-headers
28-
29-
- run:
30-
name: Testing
31-
command: yarn test
32-
33-
- save_cache:
34-
paths:
35-
- ~/.cache/yarn
36-
- yarn.lock
37-
- node_modules
38-
key: yarn-v3-{{ checksum "yarn.lock" }}
39-
1+
version: 2.1
2+
orbs:
3+
release-management: salesforce/npm-release-management@4
4+
parameters:
5+
sfdx_version:
6+
description: |
7+
By default, the latest version of the standalone CLI will be installed.
8+
To install via npm, supply a version tag such as "latest" or "6".
9+
default: ''
10+
type: string
11+
repo_tag:
12+
description: "The tag of the module repo to checkout, '' defaults to branch/PR"
13+
default: ''
14+
type: string
15+
npm_module_name:
16+
description: 'The fully qualified npm module name, i.e. @salesforce/plugins-data'
17+
default: ''
18+
type: string
19+
workflow:
20+
description: |
21+
String that controls which workflow would run.
22+
This parameter is used by automation to determine if a workflow will run
23+
within a pipeline.
24+
type: string
25+
default: 'test-and-release'
4026
workflows:
4127
version: 2
42-
build_and_test:
28+
test-and-release:
29+
when:
30+
equal: [test-and-release, << pipeline.parameters.workflow >>]
4331
jobs:
44-
- build_and_test
32+
- release-management/validate-pr:
33+
filters:
34+
branches:
35+
ignore: main
36+
- release-management/test-package:
37+
matrix:
38+
parameters:
39+
os:
40+
- linux
41+
- windows
42+
node_version:
43+
# - latest
44+
- lts
45+
- maintenance
46+
exclude:
47+
- os: windows
48+
node_version: maintenance
49+
- release-management/test-nut:
50+
context: na40-auth-url
51+
sfdx_version: latest
52+
node_version: lts
53+
size: large
54+
requires:
55+
- release-management/test-package
56+
no_output_timeout: 30m
57+
matrix:
58+
parameters:
59+
os:
60+
- linux
61+
- windows
62+
command:
63+
- 'yarn test:nuts'
64+
- release-management/release-package:
65+
sign: true
66+
github-release: true
67+
requires:
68+
- release-management/test-package
69+
filters:
70+
branches:
71+
only: main
72+
context:
73+
- CLI_CTC
74+
- AWS
75+
- release
76+
test-ts-update:
77+
when:
78+
equal: [test-ts-update, << pipeline.parameters.workflow >>]
79+
jobs:
80+
- release-management/test-ts-update
81+
just-nuts:
82+
when:
83+
equal: [just-nuts, << pipeline.parameters.workflow >>]
84+
jobs:
85+
- release-management/test-nut:
86+
name: just-nuts-<< matrix.os >>
87+
sfdx_version: << pipeline.parameters.sfdx_version >>
88+
sfdx_executable_path: sfdx
89+
repo_tag: << pipeline.parameters.repo_tag >>
90+
matrix:
91+
parameters:
92+
os:
93+
- linux
94+
- windows
95+
npm_module_name: << pipeline.parameters.npm_module_name >>
96+
context: na40-auth-url
97+
dependabot-automerge:
98+
when:
99+
equal: [dependabot-automerge, << pipeline.parameters.workflow >>]
100+
jobs:
101+
- release-management/dependabot-automerge:
102+
merge-method: squash
103+
context: release

.eslintrc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Copyright (c) 2020, salesforce.com, inc.
3+
* All rights reserved.
4+
* Licensed under the BSD 3-Clause license.
5+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6+
*/
7+
module.exports = {
8+
extends: ['eslint-config-salesforce-typescript', 'eslint-config-salesforce-license'],
9+
};

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn commitlint --edit

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn lint && yarn pretty-quick --staged

.husky/pre-push

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn build && yarn test

.mocharc.json

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
{
2-
"require": [
3-
"./test/helpers/init.js",
4-
"ts-node/register",
5-
"source-map-support/register"
6-
],
7-
"watch-files": [
8-
"**/*.js",
9-
"**/*.ts"
10-
],
2+
"require": "ts-node/register,source-map-support/register",
3+
"watch-extensions": "ts",
114
"recursive": true,
125
"reporter": "spec",
136
"timeout": 5000

.nycrc

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
{
2-
"extension": [
3-
".ts"
4-
],
5-
"include": [
6-
"src/**/*.ts"
7-
],
8-
"exclude": [
9-
"**/*.d.ts"
10-
],
11-
"all": true
2+
"nyc": {
3+
"extends": "@salesforce/dev-config/nyc"
4+
}
125
}

.prettierrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"@salesforce/prettier-config"

LICENSE.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Copyright (c) 2022, Salesforce.com, Inc.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5+
6+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7+
8+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9+
10+
* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11+
12+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

bin/dev

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env node
2+
3+
const oclif = require('@oclif/core');
4+
5+
const path = require('path');
6+
const project = path.join(__dirname, '..', 'tsconfig.json');
7+
8+
// In dev mode -> use ts-node and dev plugins
9+
process.env.NODE_ENV = 'development';
10+
11+
require('ts-node').register({ project });
12+
13+
// In dev mode, always show stack traces
14+
oclif.settings.debug = true;
15+
16+
// Start the CLI
17+
oclif.run().then(oclif.flush).catch(oclif.Errors.handle);

bin/dev.cmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
3+
node "%~dp0\dev" %*

bin/run

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env node
22

3-
require('@oclif/command').run()
4-
.catch(require('@oclif/errors/handle'))
3+
const oclif = require('@oclif/core');
4+
5+
oclif.run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle'));

command-snapshot.json

Lines changed: 18 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,20 @@
11
[
2-
{
3-
"command": "commandreference:generate",
4-
"flags": [
5-
"json",
6-
"loglevel",
7-
"outputdir",
8-
"plugins",
9-
"hidden",
10-
"erroronwarnings"
11-
]
12-
},
13-
{
14-
"command": "commands",
15-
"flags": [
16-
"help",
17-
"json",
18-
"hidden",
19-
"columns",
20-
"sort",
21-
"filter",
22-
"csv",
23-
"output",
24-
"extended",
25-
"no-truncate",
26-
"no-header"
27-
]
28-
},
29-
{
30-
"command": "force:lightning:lwc:test:create",
31-
"flags": [
32-
"json",
33-
"loglevel",
34-
"filepath"
35-
]
36-
},
37-
{
38-
"command": "force:lightning:lwc:test:run",
39-
"flags": [
40-
"json",
41-
"loglevel",
42-
"debug",
43-
"watch"
44-
]
45-
},
46-
{
47-
"command": "force:lightning:lwc:test:setup",
48-
"flags": [
49-
"json",
50-
"loglevel"
51-
]
52-
},
53-
{
54-
"command": "help",
55-
"flags": [
56-
"all"
57-
]
58-
},
59-
{
60-
"command": "snapshot:compare",
61-
"flags": [
62-
"filepath"
63-
]
64-
},
65-
{
66-
"command": "snapshot:generate",
67-
"flags": [
68-
"filepath"
69-
]
70-
}
2+
{
3+
"command": "force:lightning:lwc:test:create",
4+
"plugin": "@salesforce/sfdx-plugin-lwc-test",
5+
"flags": ["filepath", "json", "loglevel"],
6+
"alias": []
7+
},
8+
{
9+
"command": "force:lightning:lwc:test:run",
10+
"plugin": "@salesforce/sfdx-plugin-lwc-test",
11+
"flags": ["debug", "json", "loglevel", "watch"],
12+
"alias": []
13+
},
14+
{
15+
"command": "force:lightning:lwc:test:setup",
16+
"plugin": "@salesforce/sfdx-plugin-lwc-test",
17+
"flags": ["json", "loglevel"],
18+
"alias": []
19+
}
7120
]

commitlint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = { extends: ['@commitlint/config-conventional'] };

messages/run.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@
88
"watchFlagDescription": "run tests in watch mode",
99
"watchFlagLongDescription": "Runs tests when a watched file changes. Watched files include the component under test and any files it references.",
1010
"errorNoExecutableFound": "No sfdx-lwc-jest executable found. Verify it is properly installed.\nRun \"sfdx force:lightning:lwc:test:setup --help\" for installation details.",
11-
"errorInvalidFlags": "Specify only --debug or --watch, not both.",
1211
"logSuccess": "Test run complete. Exited with status code: %s"
1312
}

0 commit comments

Comments
 (0)