-
Notifications
You must be signed in to change notification settings - Fork 825
add justfile, remove coveralls, tweak ESLint #2249
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
Changes from 6 commits
17e620d
608cc3b
dd4e98e
a9ec2ad
d00f91e
3494dad
db61835
41504bc
a7deb90
3239d5d
2ef651e
ad71369
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# internal files of the nextjs example | ||
.next |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
set quiet := true | ||
|
||
import? '../sdk-codegen/justfile' | ||
|
||
# make locally installed binaries available throughout the tree without a longer specifier | ||
# this is useful in this file, but also depended on by webhook tests that expect to be able to call `eslint` and (I think) don't set it up correctly themselves. | ||
export PATH := `pwd` + "/node_modules/.bin:" + env('PATH') | ||
|
||
_default: | ||
just --list --unsorted | ||
|
||
# this uses positional-args so that mixed quoted and unquoted arguments | ||
# (like filtering for a certain test) work the way we expect | ||
# ⭐ run unit tests | ||
[positional-arguments] | ||
test *args: build | ||
mocha "$@" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was surprisingly tricky get right! By default, just groups all the args you pass to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not use *args? or are the args represented in both *args and $@? and if thats true, what happens if test is called from another just rule? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because of the way I did some testing with the following:
Which should print each arg (respecting spaces) on their own line.
I mostly pulled from the docs: https://github.com/casey/just?tab=readme-ov-file#positional-arguments |
||
|
||
# try to compile the example TS file to make sure exports work | ||
types-test: build | ||
tsc --build types/test | ||
|
||
# run full integration tests by installing a bunch of packages and starting servers (slow) | ||
integrations-test: build | ||
RUN_INTEGRATION_TESTS=1 mocha test/Integration.spec.ts | ||
xavdid-stripe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# run the full test suite; you probably want `test` | ||
ci-test: install test types-test integrations-test | ||
|
||
_build mode packageType: | ||
mkdir -p {{ mode }} | ||
tsc -p tsconfig.{{ mode }}.json | ||
echo '{"type":"{{ packageType }}"}' > {{ mode }}/package.json | ||
|
||
[private] | ||
build-esm: (_build "esm" "module") | ||
|
||
[private] | ||
build-cjs: (_build "cjs" "commonjs") | ||
|
||
# generate CJS and ESM versions of the package; mostly used as a pre-req for other steps | ||
build: build-esm build-cjs | ||
|
||
# ⭐ run style checks, fixing issues if possible | ||
lint: (lint-check "--fix") | ||
|
||
# run style checks without changing anything | ||
lint-check *args: | ||
eslint --ext .js,.ts . {{ args }} | ||
|
||
# reinstall dependencies, if needed | ||
install: | ||
yarn {{ if is_dependency() == "true" { "--silent" } else { "" } }} | ||
|
||
[no-exit-message] | ||
[private] | ||
prettier *args: | ||
# all the project-relevant JS code | ||
prettier "{src,examples,scripts,test,types}/**/*.{ts,js}" {{ args }} | ||
xavdid-stripe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# `format` needs to install since other scripts run it cold | ||
# ⭐ format all files | ||
format: install (prettier "--write --loglevel silent") | ||
# ensure other files reflect the version in package.json | ||
./scripts/updateAPIVersion.js | ||
xavdid-stripe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
# verify formatting of files (without changes) | ||
format-check: (prettier "--check") | ||
|
||
# called by tooling | ||
[private] | ||
update-version version: | ||
echo "{{ version }}" > VERSION | ||
perl -pi -e 's|"version": "[.\-\d\w]+"|"version": "{{ version }}"|' package.json | ||
perl -pi -e "s|Stripe.PACKAGE_VERSION = '[.\-\d\w]+'|Stripe.PACKAGE_VERSION = '{{ version }}'|" src/stripe.core.ts | ||
|
||
# remove build artifacts | ||
clean: | ||
rm -rf ./node_modules/.cache ./esm ./cjs |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,15 @@ import {FAKE_API_KEY} from './testUtils.js'; | |
const nodeVersion = parseInt(process.versions.node.split('.')[0], 10); | ||
|
||
describe('Integration test', function() { | ||
// these tests are expensive and start processes they don't clean up | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is why your CPU goes to 100% when running the test suite locally! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there a fix we can make here? or is it more complicated than can be fixed as part of this PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's fixable, but IMO out of scope of this PR. I didn't want to get too distracted. Plus we don't care if we're leaking on CI, since it all gets shut down when the job completes |
||
// so, skip them in the regular test suite (which we run locally) and run them via `just test-integrations` | ||
// (which is also called in CI) | ||
before(function() { | ||
if (process.env.RUN_INTEGRATION_TESTS !== '1') { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
this.timeout(50000); | ||
const testExec = (cmd: string): Promise<void> => { | ||
const child = childProcess.exec(cmd); | ||
|
Uh oh!
There was an error while loading. Please reload this page.