Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
onFinishBuildBundle: (error, start, end, chunk) => {
buffer.push({
type: 'UPDATED',
sourceId: PROCESS_SOURCE.id,
node: {
...chunk,
error,
duration: end - (start || new Date()),
},
});
},
});
// needed for validation logging to function
ProjectUtils.attachLoggerStream(projectRoot, {
stream: {
write: chunk => {
if (chunk.tag === 'device') {
buffer.push({
type: 'ADDED',
sourceId: chunk.deviceId,
node: chunk,
});
}
},
},
type: 'raw',
});
Logger.global.addStream({
stream: {
}
}
},
updateLogs: (updater: LogUpdater) => {
let newLogChunks = updater([]);
newLogChunks.forEach((newLogChunk: LogRecord) => {
if (newLogChunk.issueId && newLogChunk.issueCleared) {
return;
}
logWithLevel(newLogChunk);
});
},
});
// needed for validation logging to function
ProjectUtils.attachLoggerStream(projectDir, {
stream: {
write: (chunk: LogRecord) => {
if (chunk.tag === 'device') {
logWithLevel(chunk);
}
},
},
type: 'raw',
});
// The existing CLI modules only pass one argument to this function, so skipProjectValidation
// will be undefined in most cases. we can explicitly pass a truthy value here to avoid
// validation (eg for init)
//
// If the packager/manifest server is running and healthy, there is no need
// to rerun Doctor because the directory was already checked previously
export async function ios(Log, { root = '.', 'ios-sim-app-url': iosSimAppUrl }) {
const testSuitePath = path.resolve(root);
Log.collapsed('log in as exponent_ci_bot');
await User.initialize(XDL_CLIENT_ID);
await User.loginAsync('user-pass', XDL_LOGIN_USERPASS);
Log.collapsed('start packager');
ProjectUtils.attachLoggerStream(testSuitePath, {
type: 'raw',
stream: {
write: chunk => console.log(chunk.msg.replace(/\n$/, '')),
},
});
const packagerStarted = new Promise(resolve => {
ProjectUtils.attachLoggerStream(testSuitePath, {
type: 'raw',
stream: {
write: chunk => {
if (chunk.tag !== 'metro') {
return;
}
let payload;
try {
const allDone = new Promise(resolve => {
ProjectUtils.attachLoggerStream(testSuitePath, {
type: 'raw',
stream: {
write: chunk => {
if (chunk.msg.indexOf('[TEST-SUITE-END]') >= 0) {
resolve(JSON.parse(chunk.msg));
}
},
},
});
});
const results = await allDone;
async function action(options) {
console.log('Starting project...');
let projectDir = path.join(Directories.getExpoRepositoryRootDir(), 'apps', 'dev-mode-test');
await spawnAsync('yarn', [], {
cwd: projectDir,
});
_rewriteAppJsFileAsync(projectDir, 'INITIAL_STATE');
await Project.startAsync(projectDir);
await Fixtures.startRecordingAsync(projectDir, false, options.file || 'devModeFixture.txt');
let currentState = STATE_INITIAL;
ProjectUtils.attachLoggerStream(projectDir, {
type: 'raw',
stream: {
write: async chunk => {
if (chunk.msg.includes('DEV_MODE_TEST_FINISHED_LOADING')) {
console.log('Detected that app finished loading');
if (currentState === STATE_INITIAL) {
console.log('Triggering a live reload...');
Fixtures.recordFindTextOnScreenEvent('INITIAL_STATE');
currentState = STATE_FINISHED_FIRST_LOAD;
await _rewriteAppJsFileAsync(projectDir, 'AFTER_LIVE_RELOAD');
console.log(
`Sometimes triggering a live reload doesn't work. If it's not happening please run 'touch ${path.join(
projectDir,
'App.js'
)}'`