Skip to content

Commit

Permalink
Move fixtures to the project's root (#293)
Browse files Browse the repository at this point in the history
* Move fixtures up

* Don't wait for bundling inside start command

* Fix flow

* Update test
  • Loading branch information
thymikee authored and satya164 committed Nov 23, 2017
1 parent ef9690f commit 8599cfd
Show file tree
Hide file tree
Showing 100 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
flow-typed/**
coverage/**
vendor/**
integration_tests/fixtures/**
fixtures/**
2 changes: 1 addition & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.*/example
.*/node_modules/react-native
.*/node_modules/fbjs/*
.*/integration_tests/fixtures/.*
<PROJECT_ROOT>/fixtures/.*

[options]
module.name_mapper='^jest/\(.*\)$' -> '<PROJECT_ROOT>/jest/\1.js'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion integration_tests/__tests__/bundle/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const fs = require('fs');

export const TEST_PROJECT_DIR = path.resolve(
__dirname,
'../../fixtures/react-native-with-haul'
'../../../fixtures/react-native-with-haul'
);

export function bundleForPlatform(platform: string) {
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/__tests__/init.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const { runHaul } = require('../runHaul');

const TEST_PROJECT_DIR = path.resolve(
__dirname,
'../fixtures/react-native-clean'
'../../fixtures/react-native-clean'
);
const CONFIG_FILE_PATH = path.resolve(TEST_PROJECT_DIR, 'webpack.haul.js');
const ENTER_KEY = '\x0d';
Expand Down
19 changes: 9 additions & 10 deletions integration_tests/__tests__/start.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const stripAnsi = require('strip-ansi');
const TEMP_DIR = path.resolve(os.tmpdir(), 'start_test');
const TEST_PROJECT_DIR = path.resolve(
__dirname,
'../fixtures/react-native-with-haul'
'../../fixtures/react-native-with-haul'
);

beforeAll(() => run('yarn --mutex network', TEST_PROJECT_DIR));
Expand All @@ -31,16 +31,20 @@ test('start command displays "Select platform" message', () => {
expect(stripAnsi(stdout).trim()).toMatchSnapshot();
});

test('start --platform ios', done => {
test('starts server and bundling iOS platform', done => {
testPlatform('ios', done);
});

test('start --platform android', done => {
test('starts server and bundling Android platform', done => {
testPlatform('android', done);
});

test('starts server and bundling all platforms', done => {
testPlatform('android', done);
});

function testPlatform(platform, done) {
expect.assertions(4);
expect.hasAssertions();
const messageBuffer = [];
const haul = runHaul(TEST_PROJECT_DIR, ['start', '--platform', platform]);

Expand All @@ -56,14 +60,9 @@ function testPlatform(platform, done) {
haul.kill();
}

if (message.match('Built successfully in ')) {
if (message.match('bundling your React Native app')) {
const stdout = messageBuffer.join('\n');
expect(stdout).toMatch('INFO Ready at http://localhost:8081');
expect(stdout).toMatch('Haul is now bundling your React Native app');
expect(stdout).toMatch('A fresh build may take longer than usual');
expect(stdout).toMatch(
`You can now run the app on your ${platform} device`
);
done();
haul.kill();
}
Expand Down

0 comments on commit 8599cfd

Please sign in to comment.