-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
feat(Programmatic API): Add programmatic API #14062
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
Open
nicojs
wants to merge
43
commits into
jestjs:main
Choose a base branch
from
nicojs:feat/programmatic-api
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
908c73d
feat(Programmatic API): Add programmatic API
nicojs e2c65f8
Implement review comments
nicojs 6a75acf
Fix lint: add copyright header
nicojs 7d70600
Import performance from `perf_hooks`
nicojs 8155081
Fix type error
nicojs 79dbfd5
Remove pnpapi from types
nicojs d0fd9a9
Add e2e test for runCore
nicojs b9e9278
Update e2e test for programmatic run
nicojs d8f6e26
Fix lint e2e
nicojs 68c924f
fix prettier
nicojs 68ac3ef
Add unit tests
nicojs a375b0d
Add copyright header
nicojs 0f8f6f2
Add docs for programmatic api
nicojs 1935947
Rename `result` -> `results` to align with `runCLI` api
nicojs 77723b3
Reorder exports
nicojs a749243
Format
nicojs 48a5a94
Merge branch 'main' into feat/programmatic-api
nicojs ac2b879
Implement object oriented API proposal
nicojs e5c254f
Merge branch 'main' into feat/programmatic-api
nicojs 59cfa1a
Fix lint
nicojs d570bc8
Undo unwanted changes
nicojs 80d3c23
Undo export of `readConfigs` and `readInitialOptions`
nicojs 0b6f93d
Merge branch 'main' into feat/programmatic-api
SimenB 6877134
Merge branch 'main' into feat/programmatic-api
SimenB 26e87e1
remove unused types field in tsconfig
SimenB f3e41ef
Merge branch 'main' into feat/programmatic-api
SimenB c3b95f8
fix(expect, jest-snapshot): Pass `test.failing` tests when containing…
KhaledElmorsy 2677e1d
chore: update ESLint dependencies (#14595)
SimenB 8ec975a
chore(deps): update yarn to v3.6.4 (#14600)
renovate[bot] ccc7e4e
feat: add `jest.advanceTimersToFrame()` (#14598)
alexreardon f04118d
fix: coverage badge is broken at readme (#14611)
nolddor f8e0259
docs: provide README for `jest-haste-map` package (#14613)
Mutesa-Cedric 098cc21
docs: update with "experimental" message
nicojs 65fe53f
docs: remove mention of old `runCore`
nicojs 9f1a113
Replace old api docs with the new api using jest instance.
nicojs 8da9922
Merge branch 'main' into feat/programmatic-api
nicojs 6a26f7f
prettier
nicojs f6d0c5a
Merge branch 'main' into feat/programmatic-api
SimenB fe45d4f
Merge branch 'main' into feat/programmatic-api
nicojs ef783ed
refactor: remove unessesary config
nicojs 46a7ce9
fix: use jest's native esm api in e2e test
nicojs 9f056b8
refactor: remove `_` prefix
nicojs 92d6d44
docs: remove reference to old `readInitialOptions`.
nicojs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import {tmpdir} from 'os'; | ||
import {resolve} from 'path'; | ||
import {makeGlobalConfig, makeProjectConfig} from '@jest/test-utils'; | ||
import {runCore} from '../'; | ||
import runJest from '../runJest'; | ||
|
||
jest.mock('jest-runtime', () => ({ | ||
createHasteMap: () => ({ | ||
build: jest.fn(), | ||
}), | ||
})); | ||
jest.mock('../lib/createContext', () => jest.fn()); | ||
jest.mock('../runJest', () => | ||
jest.fn(({onComplete}) => { | ||
onComplete({results: {success: true}}); | ||
}), | ||
); | ||
|
||
describe(runCore, () => { | ||
it('should run once and provide the result', async () => { | ||
const actualResult = await runCore(makeGlobalConfig(), [ | ||
makeProjectConfig({ | ||
cacheDirectory: resolve(tmpdir(), 'jest_runCore_test'), | ||
}), | ||
]); | ||
expect(jest.mocked(runJest)).toHaveBeenCalled(); | ||
expect(actualResult).toEqual({results: {success: true}}); | ||
}); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.