new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Expo & React Native · all subjects

testing

6 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Expo Test Suite browser requirements

To run the test suite in a browser, you must use HTTPS in a canary browser with SSL disabled. Otherwise you will get an 'An SSL certificate error occurred when fetching the script' error that may randomly break tests. On macOS, this can be done by running Google Chrome with the command: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir=/tmp/foo --ignore-certificate-errors --unsafely-treat-insecure-origin-as-secure=https://localhost:19006. Do not browse the internet with this window.

How to run Expo Test Suite

Start the test suite by running 'expo start' from the test-suite directory. After startup, select which tests you want to run from the initial screen. Tests are located in the 'tests/' directory and are usually named the same as their filename.

Test module structure for Expo Test Suite

Each test module must export a 'name' property that defines the test name, and a 'test' function that takes an argument 't' (an object providing the Jasmine interface). Inside the test function, set up Jasmine suites and specs using 't.describe', 't.it', 't.expect', etc. The Jasmine functions are patched to support async functions, and asynchronous exceptions are properly caught and displayed.

Adding new test files to Expo Test Suite

Add test files in the 'tests/' directory. If the test falls into an existing category, edit one of the existing files in that directory. If you create a new file, you must add it to the 'testModules' list in 'index.js' to have it be registered.

Focus testing in Expo Test Suite with f.describe and f.it

You can focus on certain subtrees of tests using 'f.describe' or 'f.it' and other tests will be skipped. If you do this on a local instance of the app code and send the link to someone, they will run that focused test. You can then change the test and have them refresh to see the changes. This enables debugging on someone else's device, isolating issues, and potentially fixing pure JS bugs live.

Async/await support in Expo Test Suite Jasmine

The Expo Test Suite patches Jasmine functions to support async functions. This is important because most of the SDK's functionality is asynchronous. You can see an example of using async/await in a test context in 'tests/Contacts.js'.

Give your agent this brain