Reputation: 19
I have created the following /.github/workflows/testing.yml
file:
name: Linting-And-Testing
on: [push, pull_request]
jobs:
Linting-And-Testing:
name: Linting-And-Testing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Dependencies
run: npm install
- name: Run linting
run: npm run lint
- name: Run tests
run: npm test
The linting part of this file is correctly completed in seconds. However, the testing takes a long time.
When I manually run the tests for the same code on my computer, the tests finish running in seconds. However, on GitHub, they can take 6 hours to run.
The tests running are creating, reading, updating and deleting data from a Realm database.
An example of some of the tests:
describe("table", () => {
let realm;
beforeEach(() => {
realm = new Realm({ "schema": [table] });
});
afterEach(async() => {
realm.write(() => {
realm.deleteAll(); // Clear all data in the database
});
await realm.close(); // Ensure Realm is closed after each test
});
test("Create table", () => {
expect(realm.schema[0].name).toBe("Table");
});
test("Create record in table", () => {
realm.write(() => {
realm.create("Table", { "id": 1, "name": "Name", "notes": "Notes" });
});
const table = realm.objects("Table")[0];
expect(table.id).toBe(1);
expect(table.name).toBe("Name");
expect(table.notes).toBe("Notes");
});
});
I assume the reason is because the tests are running on Ubuntu instead of an Android or iOS device. If this is the reason, how would I be able to run the tests on an Android and iOS device.
Upvotes: 0
Views: 31