Skip to content

Commit

Permalink
ci: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Salakar committed Jun 24, 2024
1 parent 6ef25c7 commit 117fa04
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 11 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,29 @@ jobs:

test:
runs-on: macos-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup

- name: Start Metro Bundler
continue-on-error: true
working-directory: ./example
run: nohup sh -c "yarn start > metro.log 2>&1 &"

- name: Run unit tests
working-directory: ./example
run: jet --target=macos --coverage
run: jet --target=macos --coverage

- name: Upload Metro Log
uses: actions/upload-artifact@v4
if: always()
with:
name: metro_log
path: metro.log

build-library:
runs-on: ubuntu-latest
Expand Down
7 changes: 6 additions & 1 deletion example/.jetrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ module.exports = {
* Use this to run builds, start the application etc.
*/
async before(config) {
proc.spawnSync('npx', ['react-native', 'run-macos']);
const process = proc.spawnSync('npx', ['react-native', 'run-macos']);
if (process.exitCode !== 0) {
console.log(process.stdout.toString());
console.log(process.stderr.toString());
throw new Error('Failed to build macos.');
}
return config;
},
/**
Expand Down
2 changes: 1 addition & 1 deletion example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ErrorUtils.setGlobalHandler((err, isFatal) => {
throw err;
});

function loadTests(config: JetConfig) {
function loadTests(_: JetConfig) {
const tests = (require as any).context('./e2e', true, /\.jet\.ts$/);
tests.keys().forEach(tests);
}
Expand Down
1 change: 1 addition & 0 deletions example/e2e/example.jet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ describe('test suite example', () => {
});
});

/* eslint-disable jest/no-disabled-tests */
it.skip('test skipping example', () => {
return new Promise(resolve => setTimeout(resolve, 50));
});
14 changes: 7 additions & 7 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ async function startServer(
config: z.infer<typeof JetConfigSchema>,
after: z.infer<typeof JetAfterHook>
): Promise<void> {
server.on('started', (server) => {
const url = server.url;
server.on('started', (event) => {
const url = event.url;
console.log(`[🟩] Jet remote server listening at "${url}".`);
});

Expand Down Expand Up @@ -328,11 +328,6 @@ yargs(hideBin(process.argv))
console.log('[🚀] Starting tests...');
console.log('[🧼] Filter (--grep):', argv.grep || 'none');
console.log('[🔄] Invert filters:', argv.invert);
if (!(await isMetroRunning(argv.metroPort))) {
console.warn(
`[🟨] Metro is not running (${argv.metroPort} via '--metro-port' flag.). Start it before tests to enable stack trace symbolication.`
);
}
console.log('[🪝] Running before hook...');
const beforeHookReturnedConfig = await target.before?.(mergedConfig);
if (!beforeHookReturnedConfig) {
Expand All @@ -341,6 +336,11 @@ yargs(hideBin(process.argv))
);
process.exit(1);
}
if (!(await isMetroRunning(argv.metroPort))) {
console.warn(
`[🟨] Metro is not running (${argv.metroPort} via '--metro-port' flag.). Start it before tests to enable stack trace symbolication.`
);
}
const finalConfig = JetConfigSchema.parse(beforeHookReturnedConfig)!;
const server = new Server({
autoStart: false,
Expand Down
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export function JetProvider(props: JetProviderProps): React.JSX.Element {
return () => {
client.disconnect();
};
}, [setStatus, setConfig, setConnected]);
}, [setStatus, setConfig, props]);

return (
<JetContext.Provider
Expand Down

0 comments on commit 117fa04

Please sign in to comment.