-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add basic integration tests (#13)
* feat: add basic integration tests * test robotjs dependencies * add robotjs dependencies to workflows * change remote urls of tests projects to http * add logs to project setup in tests for debug * try again with ssh, now generating ssh key pair in workflow * setup github user and email * use http * mkdir tests project directory if does not exist * keep test projects in tmp * clone test projects before running jest * downgrade typescript to be compatible with ts-jest * go back to new version of typescript * add verbose flag to jest command * remove interactive tests and add non-interactive flag * remove the verbose option from detox test * change help message test to not use snapshots * run jest tests on macos * move test projects to this repository * ignore test projects in eslint config
- Loading branch information
Showing
250 changed files
with
109,478 additions
and
61 deletions.
There are no files selected for viewing
This file contains 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 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,17 @@ | ||
name: Run Jest | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
jest: | ||
name: Jest | ||
runs-on: macos-latest | ||
steps: | ||
- name: 🏗 Setup repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: 📦 Install dependencies | ||
run: yarn | ||
|
||
- name: 🎭 Run Jest | ||
run: yarn test |
This file contains 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 |
---|---|---|
@@ -1,14 +1,17 @@ | ||
name: Check ESLint | ||
on: | ||
- pull_request | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
test: | ||
lint: | ||
name: ESLint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 🏗 Setup repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: 📦 Install dependencies | ||
run: yarn | ||
|
||
- name: 🤓 Run ESLint | ||
run: yarn --cwd . lint | ||
run: yarn lint |
This file contains 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 |
---|---|---|
@@ -1,14 +1,17 @@ | ||
name: Prettier check | ||
on: | ||
- pull_request | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
prettier-check: | ||
name: Prettier check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 🏗 Setup repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: 📦 Install dependencies | ||
run: yarn | ||
|
||
- name: ✨ Run Prettier check | ||
run: yarn --cwd . prettier:check | ||
run: yarn prettier:check |
This file contains 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 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 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 |
---|---|---|
@@ -1,14 +1,17 @@ | ||
name: Run Typescript | ||
on: | ||
- pull_request | ||
name: Typescript check | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
test: | ||
name: Typescript | ||
typescript-check: | ||
name: Typescript check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 🏗 Setup repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: 📦 Install dependencies | ||
run: yarn | ||
|
||
- name: 🔨 Run Typescript | ||
run: yarn --cwd . ts:check | ||
run: yarn ts:check |
This file contains 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
dist | ||
build | ||
__tests__/test-projects |
This file was deleted.
Oops, something went wrong.
This file contains 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,31 @@ | ||
import { cli } from './utils' | ||
import { version } from '../package.json' | ||
|
||
test('prints version', async () => { | ||
const output = await cli(['--version']) | ||
expect(output).toContain(version) | ||
}) | ||
|
||
test('prints help', async () => { | ||
const output = await cli(['--help']) | ||
|
||
expect(output).toContain(version) | ||
|
||
for (const message of [ | ||
'Welcome to react-native-ci-cli', | ||
'Quickly setup CI workflows for your React Native app', | ||
'--help', | ||
'--version', | ||
'--skip-git-check', | ||
'--preset', | ||
'Use any combination of the following with --preset flag to specify your own set of workflows to generate', | ||
'--lint', | ||
'--jest', | ||
'--ts', | ||
'--prettier', | ||
'--eas-update', | ||
'--detox', | ||
]) { | ||
expect(output).toContain(message) | ||
} | ||
}) |
This file contains 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 @@ | ||
import { rm } from 'fs/promises' | ||
import { join } from 'path' | ||
import { | ||
cli, | ||
removeTestProject, | ||
setupTestProject, | ||
TEST_PROJECTS, | ||
} from './utils' | ||
|
||
describe('fail fast scenarios', () => { | ||
afterEach(removeTestProject) | ||
|
||
test('fails when cwd has no package.json', async () => { | ||
const { appRoot } = TEST_PROJECTS['rn-setup-ci-yarn-flat'] | ||
setupTestProject('rn-setup-ci-yarn-flat') | ||
|
||
await rm(join(appRoot, 'package.json')) | ||
|
||
const output = await cli(['--skip-git-check'], { cwd: appRoot }) | ||
|
||
expect(output).toContain( | ||
'No package.json found in current directory. Are you sure you are in a project directory?' | ||
) | ||
}) | ||
|
||
test('fails when cwd is monorepo root', async () => { | ||
const { repoRoot } = TEST_PROJECTS['rn-setup-ci-yarn-monorepo'] | ||
setupTestProject('rn-setup-ci-yarn-monorepo') | ||
|
||
const output = await cli([], { cwd: repoRoot }) | ||
|
||
expect(output).toContain( | ||
'The current directory is workspace root directory. Please run the script again from selected package root directory.' | ||
) | ||
}) | ||
}) |
Oops, something went wrong.