Skip to content

Commit

Permalink
Parking orbits the sfdx-plugin-lwc-test plugin (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
WillieRuemmele authored Jun 30, 2022
1 parent 5450da2 commit 9a8bcd0
Show file tree
Hide file tree
Showing 33 changed files with 6,330 additions and 2,015 deletions.
141 changes: 100 additions & 41 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,103 @@
---
version: 2
jobs:
build_and_test:
working_directory: ~/sfdx-plugin-lwc-test

docker:
- image: circleci/node:lts

steps:
- checkout

- restore_cache:
keys:
- yarn-v3-{{ checksum "yarn.lock" }}

- run:
name: Install dependencies
command: yarn

- run:
name: Build
command: yarn build

- run:
name: Check License Headers
command: yarn check-license-headers

- run:
name: Testing
command: yarn test

- save_cache:
paths:
- ~/.cache/yarn
- yarn.lock
- node_modules
key: yarn-v3-{{ checksum "yarn.lock" }}

version: 2.1
orbs:
release-management: salesforce/npm-release-management@4
parameters:
sfdx_version:
description: |
By default, the latest version of the standalone CLI will be installed.
To install via npm, supply a version tag such as "latest" or "6".
default: ''
type: string
repo_tag:
description: "The tag of the module repo to checkout, '' defaults to branch/PR"
default: ''
type: string
npm_module_name:
description: 'The fully qualified npm module name, i.e. @salesforce/plugins-data'
default: ''
type: string
workflow:
description: |
String that controls which workflow would run.
This parameter is used by automation to determine if a workflow will run
within a pipeline.
type: string
default: 'test-and-release'
workflows:
version: 2
build_and_test:
test-and-release:
when:
equal: [test-and-release, << pipeline.parameters.workflow >>]
jobs:
- build_and_test
- release-management/validate-pr:
filters:
branches:
ignore: main
- release-management/test-package:
matrix:
parameters:
os:
- linux
- windows
node_version:
# - latest
- lts
- maintenance
exclude:
- os: windows
node_version: maintenance
- release-management/test-nut:
context: na40-auth-url
sfdx_version: latest
node_version: lts
size: large
requires:
- release-management/test-package
no_output_timeout: 30m
matrix:
parameters:
os:
- linux
- windows
command:
- 'yarn test:nuts'
- release-management/release-package:
sign: true
github-release: true
requires:
- release-management/test-package
filters:
branches:
only: main
context:
- CLI_CTC
- AWS
- release
test-ts-update:
when:
equal: [test-ts-update, << pipeline.parameters.workflow >>]
jobs:
- release-management/test-ts-update
just-nuts:
when:
equal: [just-nuts, << pipeline.parameters.workflow >>]
jobs:
- release-management/test-nut:
name: just-nuts-<< matrix.os >>
sfdx_version: << pipeline.parameters.sfdx_version >>
sfdx_executable_path: sfdx
repo_tag: << pipeline.parameters.repo_tag >>
matrix:
parameters:
os:
- linux
- windows
npm_module_name: << pipeline.parameters.npm_module_name >>
context: na40-auth-url
dependabot-automerge:
when:
equal: [dependabot-automerge, << pipeline.parameters.workflow >>]
jobs:
- release-management/dependabot-automerge:
merge-method: squash
context: release
9 changes: 9 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright (c) 2020, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
module.exports = {
extends: ['eslint-config-salesforce-typescript', 'eslint-config-salesforce-license'],
};
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint && yarn pretty-quick --staged
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn build && yarn test
11 changes: 2 additions & 9 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
{
"require": [
"./test/helpers/init.js",
"ts-node/register",
"source-map-support/register"
],
"watch-files": [
"**/*.js",
"**/*.ts"
],
"require": "ts-node/register,source-map-support/register",
"watch-extensions": "ts",
"recursive": true,
"reporter": "spec",
"timeout": 5000
Expand Down
13 changes: 3 additions & 10 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
{
"extension": [
".ts"
],
"include": [
"src/**/*.ts"
],
"exclude": [
"**/*.d.ts"
],
"all": true
"nyc": {
"extends": "@salesforce/dev-config/nyc"
}
}
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"@salesforce/prettier-config"
12 changes: 12 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Copyright (c) 2022, Salesforce.com, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

* 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.

* 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.

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.
17 changes: 17 additions & 0 deletions bin/dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env node

const oclif = require('@oclif/core');

const path = require('path');
const project = path.join(__dirname, '..', 'tsconfig.json');

// In dev mode -> use ts-node and dev plugins
process.env.NODE_ENV = 'development';

require('ts-node').register({ project });

// In dev mode, always show stack traces
oclif.settings.debug = true;

// Start the CLI
oclif.run().then(oclif.flush).catch(oclif.Errors.handle);
3 changes: 3 additions & 0 deletions bin/dev.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node "%~dp0\dev" %*
5 changes: 3 additions & 2 deletions bin/run
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env node

require('@oclif/command').run()
.catch(require('@oclif/errors/handle'))
const oclif = require('@oclif/core');

oclif.run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle'));
87 changes: 18 additions & 69 deletions command-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,71 +1,20 @@
[
{
"command": "commandreference:generate",
"flags": [
"json",
"loglevel",
"outputdir",
"plugins",
"hidden",
"erroronwarnings"
]
},
{
"command": "commands",
"flags": [
"help",
"json",
"hidden",
"columns",
"sort",
"filter",
"csv",
"output",
"extended",
"no-truncate",
"no-header"
]
},
{
"command": "force:lightning:lwc:test:create",
"flags": [
"json",
"loglevel",
"filepath"
]
},
{
"command": "force:lightning:lwc:test:run",
"flags": [
"json",
"loglevel",
"debug",
"watch"
]
},
{
"command": "force:lightning:lwc:test:setup",
"flags": [
"json",
"loglevel"
]
},
{
"command": "help",
"flags": [
"all"
]
},
{
"command": "snapshot:compare",
"flags": [
"filepath"
]
},
{
"command": "snapshot:generate",
"flags": [
"filepath"
]
}
{
"command": "force:lightning:lwc:test:create",
"plugin": "@salesforce/sfdx-plugin-lwc-test",
"flags": ["filepath", "json", "loglevel"],
"alias": []
},
{
"command": "force:lightning:lwc:test:run",
"plugin": "@salesforce/sfdx-plugin-lwc-test",
"flags": ["debug", "json", "loglevel", "watch"],
"alias": []
},
{
"command": "force:lightning:lwc:test:setup",
"plugin": "@salesforce/sfdx-plugin-lwc-test",
"flags": ["json", "loglevel"],
"alias": []
}
]
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
1 change: 0 additions & 1 deletion messages/run.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
"watchFlagDescription": "run tests in watch mode",
"watchFlagLongDescription": "Runs tests when a watched file changes. Watched files include the component under test and any files it references.",
"errorNoExecutableFound": "No sfdx-lwc-jest executable found. Verify it is properly installed.\nRun \"sfdx force:lightning:lwc:test:setup --help\" for installation details.",
"errorInvalidFlags": "Specify only --debug or --watch, not both.",
"logSuccess": "Test run complete. Exited with status code: %s"
}
Loading

0 comments on commit 9a8bcd0

Please sign in to comment.